text.splitlines() returns [] for empty strings. Accessing msg_lines[0] then raises IndexError, making session resume crash when the session contains a message with empty or whitespace-only text (e.g. reasoning-only turns, tool-only assistant messages). Guard with `or [""]` in all three branches (user, assistant_last, regular assistant) so an empty message renders as a blank line. Fixes #59265 Co-authored-by: AlexFucuson9 <AlexFucuson9@users.noreply.github.com>