From 02ea501c8137db75d6ded3f701a00df6b9beac16 Mon Sep 17 00:00:00 2001 From: "Jasper v. Blanckenburg" Date: Fri, 19 May 2023 15:37:12 +0200 Subject: [PATCH] Prevent uninitialized buffer --- TouchGFX/gui/src/containers/ErrorPopup.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/TouchGFX/gui/src/containers/ErrorPopup.cpp b/TouchGFX/gui/src/containers/ErrorPopup.cpp index a281a98..e117fc2 100644 --- a/TouchGFX/gui/src/containers/ErrorPopup.cpp +++ b/TouchGFX/gui/src/containers/ErrorPopup.cpp @@ -12,10 +12,6 @@ void ErrorPopup::showAMSError() { title.setTypedText(T_ERROR_AMS); title.invalidate(); switch (vehicle_state.last_ams_error.kind) { - case AMS_ERROR_NONE: - touchgfx::Unicode::strncpy(detailsBuffer, "UNKNOWN ERROR", - sizeof(detailsBuffer) / sizeof(*detailsBuffer)); - break; case AMS_ERROR_SLAVE_TIMEOUT: touchgfx::Unicode::snprintf( detailsBuffer, sizeof(detailsBuffer) / sizeof(*detailsBuffer), @@ -65,6 +61,11 @@ void ErrorPopup::showAMSError() { touchgfx::Unicode::strncpy(detailsBuffer, "Shunt overtemperature", sizeof(detailsBuffer) / sizeof(*detailsBuffer)); break; + case AMS_ERROR_NONE: + default: + touchgfx::Unicode::strncpy(detailsBuffer, "UNKNOWN ERROR", + sizeof(detailsBuffer) / sizeof(*detailsBuffer)); + break; } details.setWildcard(detailsBuffer); details.invalidate();