diff --git a/firmware/controllers/system/event_queue.cpp b/firmware/controllers/system/event_queue.cpp index 96ec3f6c46..06684dd8b7 100644 --- a/firmware/controllers/system/event_queue.cpp +++ b/firmware/controllers/system/event_queue.cpp @@ -117,6 +117,7 @@ int EventQueue::executeAll(efitime_t now) { // we need safe iteration because we are removing elements inside the loop LL_FOREACH_SAFE(head, current, tmp) { + efiAssert(current->callback != NULL, "callback==null1", 0); if (++listIterationCounter > QUEUE_LENGTH_LIMIT) { firmwareError("Is this list looped?"); return false; @@ -145,6 +146,7 @@ int EventQueue::executeAll(efitime_t now) { */ LL_FOREACH_SAFE(executionList, current, tmp) { + efiAssert(current->callback != NULL, "callback==null2", 0); uint32_t before = GET_TIMESTAMP(); current->isScheduled = false; int howFarOff = now - current->momentX; diff --git a/unit_tests/test_trigger_decoder.cpp b/unit_tests/test_trigger_decoder.cpp index 7df112f3ea..2c89611afd 100644 --- a/unit_tests/test_trigger_decoder.cpp +++ b/unit_tests/test_trigger_decoder.cpp @@ -291,6 +291,7 @@ extern engine_pins_s enginePins; void testRpmCalculator(void) { printf("*************************************************** testRpmCalculator\r\n"); timeNow = 0; + schedulingQueue.clear(); EngineTestHelper eth(FORD_INLINE_6_1995); EXPAND_EngineTestHelper; @@ -321,7 +322,7 @@ void testRpmCalculator(void) { eth.engine.triggerCentral.addEventListener(mainTriggerCallback, "main loop", ð.engine); - schedulingQueue.clear(); + schedulingQueue.executeAll(99999999); // this is needed to clear 'isScheduled' flag assertEqualsM("queue size/0", 0, schedulingQueue.size()); debugSignalExecutor = true;