fix(ui): guard parseColoredText against non-string inputs

This commit is contained in:
troytt 2026-10-02 11:15:46 +00:00
parent 7e46fab753
commit a08b837ba5
1 changed files with 3 additions and 0 deletions

View File

@ -113,6 +113,9 @@ export function parseFontTblMetrics(tblBytes: Uint8Array): {
* Split a string containing Diablo II `ÿcX` color codes into colored spans.
*/
export function parseColoredText(input: string, defaultColor: D2ColorCode = 'white'): TextSpan[] {
if (!input || typeof input !== 'string') {
return []
}
const spans: TextSpan[] = []
let currentColor: D2ColorCode = defaultColor
let buf = ''