Added check for gBattleStringsTable (#6948)

This commit is contained in:
Eduardo Quezada 2025-05-22 15:05:22 -04:00 committed by GitHub
parent 48100e9593
commit 2e3ae0d167
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 5 deletions

View File

@ -684,12 +684,22 @@ static s32 MgbaVPrintf_(const char *fmt, va_list va)
break;
case 'S':
pokeS = va_arg(va, const u8 *);
while ((c = *pokeS++) != EOS)
if (pokeS == NULL)
{
if ((c = gWireless_RSEtoASCIITable[c]) != '\0')
i = MgbaPutchar_(i, c);
else
i = MgbaPutchar_(i, '?');
i = MgbaPutchar_(i, 'N');
i = MgbaPutchar_(i, 'U');
i = MgbaPutchar_(i, 'L');
i = MgbaPutchar_(i, 'L');
}
else
{
while ((c = *pokeS++) != EOS)
{
if ((c = gWireless_RSEtoASCIITable[c]) != '\0')
i = MgbaPutchar_(i, c);
else
i = MgbaPutchar_(i, '?');
}
}
break;
}

View File

@ -811,6 +811,7 @@ TEST("Battle strings fit on the battle message window")
default:
break;
}
EXPECT(gBattleStringsTable[battleStringId] != NULL);
BattleStringExpandPlaceholders(gBattleStringsTable[battleStringId], battleString, BATTLE_STRING_BUFFER_SIZE);
DebugPrintf("Battle String ID %d: %S", battleStringId, battleString);
for (j = 1;; j++)