mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-07 14:14:52 +00:00
more fix, less crash
This commit is contained in:
parent
d33303a038
commit
8190211b90
@ -133,7 +133,7 @@ void NotificationRenderer::drawAlertBannerOverlay(OLEDDisplay *display, OLEDDisp
|
|||||||
uint8_t effectiveLineHeight = FONT_HEIGHT_SMALL - 3;
|
uint8_t effectiveLineHeight = FONT_HEIGHT_SMALL - 3;
|
||||||
uint8_t visibleTotalLines = std::min<uint8_t>(totalLines, (screenHeight - vPadding * 2) / effectiveLineHeight);
|
uint8_t visibleTotalLines = std::min<uint8_t>(totalLines, (screenHeight - vPadding * 2) / effectiveLineHeight);
|
||||||
uint8_t linesShown = lineCount;
|
uint8_t linesShown = lineCount;
|
||||||
const char *linePointers[visibleTotalLines]; // this is sort of a dynamic allocation
|
const char *linePointers[visibleTotalLines + 1] = {0}; // this is sort of a dynamic allocation
|
||||||
|
|
||||||
// copy the linestarts to display to the linePointers holder
|
// copy the linestarts to display to the linePointers holder
|
||||||
for (int i = 0; i < lineCount; i++) {
|
for (int i = 0; i < lineCount; i++) {
|
||||||
@ -186,8 +186,7 @@ void NotificationRenderer::drawNotificationBox(OLEDDisplay *display, OLEDDisplay
|
|||||||
is_picker = true;
|
is_picker = true;
|
||||||
// seelction box
|
// seelction box
|
||||||
|
|
||||||
while (lineCount < totalLines) {
|
while (lines[lineCount] != nullptr) {
|
||||||
if (lines[lineCount] != nullptr) {
|
|
||||||
auto newlinePointer = strchr(lines[lineCount], '\n');
|
auto newlinePointer = strchr(lines[lineCount], '\n');
|
||||||
if (newlinePointer)
|
if (newlinePointer)
|
||||||
lineLengths[lineCount] = (newlinePointer - lines[lineCount]); // Check for newlines first
|
lineLengths[lineCount] = (newlinePointer - lines[lineCount]); // Check for newlines first
|
||||||
@ -200,9 +199,6 @@ void NotificationRenderer::drawNotificationBox(OLEDDisplay *display, OLEDDisplay
|
|||||||
maxWidth = lineWidths[lineCount];
|
maxWidth = lineWidths[lineCount];
|
||||||
}
|
}
|
||||||
lineCount++;
|
lineCount++;
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// count lines
|
// count lines
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user