Skip to content

Commit

Permalink
Fix bug where uninitialised value of list was accessed; remember, C++…
Browse files Browse the repository at this point in the history
… is zero-indexed!
  • Loading branch information
PeteHaitch committed Apr 25, 2015
1 parent 178e48b commit 9162c8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: methsim
Type: Package
Title: An R package to simulate DNA methylation data
Version: 0.5.0.9012
Date: 2015-04-24
Version: 0.5.0.9013
Date: 2015-04-25
Author: Peter Hickey <peter.hickey@gmail.com>
Maintainer: Peter Hickey <peter.hickey@gmail.com>
Description: methsim is software to simulate DNA methylation sequencing data.
Expand Down
4 changes: 2 additions & 2 deletions src/simulateZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ Rcpp::List simulatez(IntegerVector fh,
// TODO: Check that all elements of P have the identical and proper
// dimensions.
// The below only checks the first element has the proper nrow.
if (MarginalProb.nrow() != P[1].nrow()) {
if (MarginalProb.nrow() != P[0].nrow()) {
Rcpp::stop("length(marginalProb) != nrow(P[[1]])");
}
// Make sure we don't try to access out of bounds elements of P.
if (max(fh + nh - 1) > P[1].nrow()) {
if (max(fh + nh - 1) > P[0].nrow()) {
Rcpp::stop("max(fh + nh - 1) > nrow(P)");
}

Expand Down

0 comments on commit 9162c8b

Please sign in to comment.