Prevent uninitialized buffer

This commit is contained in:
Jasper Blanckenburg 2023-05-19 15:37:12 +02:00
parent c159d9bda9
commit 02ea501c81
1 changed files with 5 additions and 4 deletions

View File

@ -12,10 +12,6 @@ void ErrorPopup::showAMSError() {
title.setTypedText(T_ERROR_AMS); title.setTypedText(T_ERROR_AMS);
title.invalidate(); title.invalidate();
switch (vehicle_state.last_ams_error.kind) { 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: case AMS_ERROR_SLAVE_TIMEOUT:
touchgfx::Unicode::snprintf( touchgfx::Unicode::snprintf(
detailsBuffer, sizeof(detailsBuffer) / sizeof(*detailsBuffer), detailsBuffer, sizeof(detailsBuffer) / sizeof(*detailsBuffer),
@ -65,6 +61,11 @@ void ErrorPopup::showAMSError() {
touchgfx::Unicode::strncpy(detailsBuffer, "Shunt overtemperature", touchgfx::Unicode::strncpy(detailsBuffer, "Shunt overtemperature",
sizeof(detailsBuffer) / sizeof(*detailsBuffer)); sizeof(detailsBuffer) / sizeof(*detailsBuffer));
break; break;
case AMS_ERROR_NONE:
default:
touchgfx::Unicode::strncpy(detailsBuffer, "UNKNOWN ERROR",
sizeof(detailsBuffer) / sizeof(*detailsBuffer));
break;
} }
details.setWildcard(detailsBuffer); details.setWildcard(detailsBuffer);
details.invalidate(); details.invalidate();