oappend() debug message when buffer is full
oappend() silently discards strings when the buffer is full, leading to strange effects like half-working UI pages. The new debug message will help developers to understand what could be wrong.
This commit is contained in:
parent
fc1dd2daac
commit
bb45bee7f8
@ -148,8 +148,14 @@ bool oappendi(int i)
|
||||
bool oappend(const char* txt)
|
||||
{
|
||||
uint16_t len = strlen(txt);
|
||||
if (olen + len >= SETTINGS_STACK_BUF_SIZE)
|
||||
if (olen + len >= SETTINGS_STACK_BUF_SIZE) {
|
||||
#ifdef WLED_DEBUG
|
||||
DEBUG_PRINT(F("oappend() buffer overflow. Cannnot append "));
|
||||
DEBUG_PRINT(len); DEBUG_PRINT(F(" bytes \t\""));
|
||||
DEBUG_PRINT(txt); DEBUG_PRINTLN(F("\""));
|
||||
#endif
|
||||
return false; // buffer full
|
||||
}
|
||||
strcpy(obuf + olen, txt);
|
||||
olen += len;
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user