[Xts-commits] r792 - pkg/xts/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Sep 19 14:00:40 CEST 2013


Author: bodanker
Date: 2013-09-19 14:00:40 +0200 (Thu, 19 Sep 2013)
New Revision: 792

Modified:
   pkg/xts/src/endpoints.c
Log:
- Add error when k <= 0

Modified: pkg/xts/src/endpoints.c
===================================================================
--- pkg/xts/src/endpoints.c	2013-08-29 12:56:54 UTC (rev 791)
+++ pkg/xts/src/endpoints.c	2013-09-19 12:00:40 UTC (rev 792)
@@ -21,6 +21,9 @@
   int k  = INTEGER(coerceVector(_k,INTSXP))[0];
   nr = nrows(_x);
 
+  /* ensure k > 0 (bug #4920) */
+  if(k <= 0) error("'k' must be > 0");
+
   /* endpoints objects. max nr+2 ( c(0,ep,nr) ) */
   SEXP _ep = PROTECT(allocVector(INTSXP,nr+2)); P++;
   int *ep = INTEGER(_ep);



More information about the Xts-commits mailing list