From 0eabad2c6fde26e07df8ff483e5610b99841150e Mon Sep 17 00:00:00 2001 From: dron0gus Date: Fri, 3 Jan 2020 17:13:55 +0300 Subject: [PATCH] icu trigger: do not crash on incorrect brainPin (#1082) * icu trigger: do not crash on incorrect brainPin * Update trigger_input_icu.cpp --- firmware/hw_layer/trigger_input_icu.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/firmware/hw_layer/trigger_input_icu.cpp b/firmware/hw_layer/trigger_input_icu.cpp index 50a601694a..22589b6092 100644 --- a/firmware/hw_layer/trigger_input_icu.cpp +++ b/firmware/hw_layer/trigger_input_icu.cpp @@ -87,6 +87,11 @@ void turnOnTriggerInputPin(const char *msg, int index, bool isTriggerShaft) { } digital_input_s* input = startDigitalCapture("trigger", brainPin, true); + if (input == NULL) { + /* error already reported */ + return; + } + if (isTriggerShaft) { void * arg = (void*) (index == 0); input->setWidthCallback((VoidInt)(void*)shaftWidthCallback, arg);