When either ADDL or II are not found in the data set, lastdose continues to check for missing values, resulting in undefined behavior. The solution is to drop has_addl checks and/or pass in vectors of all zeros for ADDL and II when they are missing.
Tests
inst/tests/test-lastdose.R
undefined behavior when checking ADDL and II issue-11
Summary
When either ADDL or II are not found in the data set, lastdose continues to check for missing values, resulting in undefined behavior. The solution is to drop
has_addl
checks and/or pass in vectors of all zeros for ADDL and II when they are missing.Tests