diff --git a/src/client/ui/font.ts b/src/client/ui/font.ts index 2b32e33..50fbd73 100644 --- a/src/client/ui/font.ts +++ b/src/client/ui/font.ts @@ -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 = ''