[bugfix] splash goes into infinite loop when vp is too small

chris_s reported that a vp width of 1 wpuld cause the trxt reflow to go into an endless loop

check for this and skip displaying the splash
add a warning to the sim for catching unintentional cases of this

Change-Id: I9e1c561f745b5bcf113d0a6cdff57a00cd190fd4
This commit is contained in:
William Wilgus 2026-05-16 17:33:20 -04:00
parent 7c2e84ad2f
commit d8db60b34a

View file

@ -104,10 +104,13 @@ static bool splash_internal(struct screen * screen, const char *fmt, va_list ap,
int res = vsnprintf(splash_buf, sizeof(splash_buf), fmt, ap);
va_end(ap);
if (res <= 0)
if (res <= 0 || width < space_w || height < chr_h)
{
#ifdef SIMULATOR
printf("%s ERROR %d\n", __func__, res);
if (res <= 0)
printf("ERROR: %s %d\n", __func__, res);
else
printf("WARNING: %s vp too small\n", __func__);
#endif
return false; /* nothing to display */
}