From c9943057f4f490f55a4c2ded5d77a8babcbe3315 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Thu, 10 Feb 2022 12:01:56 -0800 Subject: [PATCH] Abort processing if there was no command Signed-off-by: Jesse Vincent --- .../src/kaleidoscope/plugin/FocusSerial.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index 071183a1..a6f89b9b 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -45,6 +45,12 @@ EventHandlerResult FocusSerial::afterEachCycle() { if (command_[i - 1] == SEPARATOR ) command_[i - 1] = '\0'; + + // If there was no command, there's nothing to do + if (command_[0] == '\0') { + return EventHandlerResult::OK; + } + Runtime.onFocusEvent(command_); while (Runtime.serialPort().available()) {