diff --git a/arch/sim/src/sim/sim_oneshot.c b/arch/sim/src/sim/sim_oneshot.c index df89fd8ae3..636dff052b 100644 --- a/arch/sim/src/sim/sim_oneshot.c +++ b/arch/sim/src/sim/sim_oneshot.c @@ -364,12 +364,15 @@ static int sim_cancel(struct oneshot_lowerhalf_s *lower, struct timespec current; irqstate_t flags; - DEBUGASSERT(priv != NULL && ts != NULL); + DEBUGASSERT(priv != NULL); flags = enter_critical_section(); - sim_timer_current(¤t); - clock_timespec_subtract(&priv->alarm, ¤t, ts); + if (ts != NULL) + { + sim_timer_current(¤t); + clock_timespec_subtract(&priv->alarm, ¤t, ts); + } sim_reset_alarm(&priv->alarm); sim_update_hosttimer();