From 1cc147cc983d4dde2c8e01338bae28fd29a796e2 Mon Sep 17 00:00:00 2001 From: Neil McKechnie Date: Tue, 16 Mar 2021 22:02:39 +0000 Subject: [PATCH] Ensure loop2() doesn't run during initialisation if there's no display. Prevent loop2 from doing anything when lcdDisplay not set up. If there's a display configured but not one attached, then the OLED code will set lcdDisplay to null and no display will be configured or used by the loop() function. However, because of the way the initialisation code works, loop2() is called during initialisation. --- LCDDisplay.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/LCDDisplay.cpp b/LCDDisplay.cpp index c559c76..991db7d 100644 --- a/LCDDisplay.cpp +++ b/LCDDisplay.cpp @@ -72,6 +72,7 @@ void LCDDisplay::loop() { } LCDDisplay *LCDDisplay::loop2(bool force) { + if (!lcdDisplay) return NULL; unsigned long currentMillis = millis(); if (!force) {