Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Handle cases when idx > ind->ndoses
Browse files Browse the repository at this point in the history
mattfidler committed Jan 15, 2024

Verified

This commit was signed with the committer’s verified signature.
mattfidler Matthew Fidler
1 parent e97d1a4 commit 47b6ece
Showing 2 changed files with 8 additions and 9 deletions.
10 changes: 7 additions & 3 deletions inst/include/rxode2parseHandleEvid.h
Original file line number Diff line number Diff line change
@@ -262,9 +262,13 @@ extern "C" {
static inline void handleInfusionGetEndOfInfusionIndex(int idx, int *infEixds,
rx_solve *rx, rx_solving_options *op,
rx_solving_options_ind *ind) {
int curEvid = getEvid(ind, ind->idose[idx]);
double curAmt = getDoseNumber(ind, idx);
int lastKnownOff = 0;
ind curEvid = 0, lastKnownOff = 0;
double curAmt = 0.0;
if (idx < ind->ndoses) {
curEvid = getEvid(ind, ind->idose[idx]);
curAmt = getDoseNumber(ind, idx);
lastKnownOff = 0;
}
*infEixds = -1;
for (int j = 0; j < ind->ndoses; j++) {
if (curEvid == getEvid(ind, ind->idose[j]) &&
7 changes: 1 addition & 6 deletions src/comp.c
Original file line number Diff line number Diff line change
@@ -80,11 +80,6 @@ void solveWith1Pt_lin(double *yp,
rx_solve *rx=(&rx_global);
lin_context_c_t *lin = (lin_context_c_t*)(ctx);
int linCmt = ind->linCmt;
/* int ret = 1; */
/* int linNcmt = linCmtI[RxMvFlag_ncmt]; */
/* int linKa = linCmtI[RxMvFlag_ka]; */
/* rx->linKa = linKa; */
/* rx->linNcmt = linNcmt; */
int ret = 1;
switch(rx->linNcmt) {
case 3:
@@ -679,7 +674,7 @@ SEXP _rxode2parse_compC(SEXP in, SEXP mv) {
}
}
for (int i = indR.ndoses; i< indR.n_all_times; ++i) {
indR.idose[i] = -NA_INTEGER;
indR.idose[i] = 0;
}
int *tmpI = (int*)malloc(EVID_EXTRA_SIZE* sizeof(int));
if (tmpI == NULL) {

0 comments on commit 47b6ece

Please sign in to comment.