From a08b837ba55c9f0df1623897db8baa41249474f7 Mon Sep 17 00:00:00 2001 From: troytt <47798984@qq.com> Date: Fri, 2 Oct 2026 11:15:46 +0000 Subject: [PATCH] fix(ui): guard parseColoredText against non-string inputs --- src/client/ui/font.ts | 3 +++ 1 file changed, 3 insertions(+) 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 = ''