From b84391df893ea60395ab5c01d3112e8318048061 Mon Sep 17 00:00:00 2001 From: Wusaweki Date: Sun, 5 Nov 2023 16:19:13 +0100 Subject: [PATCH] fix null pointer access in display.h --- src/plugins/Display/Display.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/Display/Display.h b/src/plugins/Display/Display.h index c4853bab4..932c1a8fe 100644 --- a/src/plugins/Display/Display.h +++ b/src/plugins/Display/Display.h @@ -91,12 +91,14 @@ class Display { Inverter<> *iv; record_t<> *rec; bool allOff = true; - for (uint8_t i = 0; i < mSys->getNumInverters(); i++) { + uint8_t nInv = mSys->getNumInverters(); + for (uint8_t i = 0; i < nInv; i++) { iv = mSys->getInverterByPos(i); - rec = iv->getRecordStruct(RealTimeRunData_Debug); if (iv == NULL) continue; + rec = iv->getRecordStruct(RealTimeRunData_Debug); + if (iv->isProducing()) nrprod++; else