From 3754792215e022b31d6f02da4c7f9c26b2a405a7 Mon Sep 17 00:00:00 2001 From: Vadim Peretokin Date: Sun, 15 Dec 2024 20:25:21 +0100 Subject: [PATCH] Fix: crash on empty theme file settings (#7560) #### Brief overview of PR changes/additions Fix crash on empty theme file settings by assuming the default theme. #### Motivation for adding to Mudlet Closes https://github.com/Mudlet/Mudlet/issues/7557 #### Other info (issues closed, discussion etc) An alternative to https://github.com/Mudlet/Mudlet/pull/7551 - this solution is more straightforward. --------- Co-authored-by: Vadim Peretokin --- src/XMLimport.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/XMLimport.cpp b/src/XMLimport.cpp index 7f13b37517a..64832ba45d3 100644 --- a/src/XMLimport.cpp +++ b/src/XMLimport.cpp @@ -786,6 +786,10 @@ void XMLimport::readHost(Host* pHost) pHost->mMapperShowRoomBorders = readDefaultTrueBool(qsl("mMapperShowRoomBorders")); pHost->mEditorTheme = attributes().value(QLatin1String("mEditorTheme")).toString(); pHost->mEditorThemeFile = attributes().value(QLatin1String("mEditorThemeFile")).toString(); + if (pHost->mEditorTheme.isEmpty() || pHost->mEditorThemeFile.isEmpty()) { + pHost->mEditorTheme = qsl("Mudlet"); + pHost->mEditorThemeFile = qsl("Mudlet.tmTheme"); + } pHost->mThemePreviewItemID = attributes().value(QLatin1String("mThemePreviewItemID")).toInt(); pHost->mThemePreviewType = attributes().value(QLatin1String("mThemePreviewType")).toString(); pHost->setHaveColorSpaceId(attributes().value(QLatin1String("mSGRCodeHasColSpaceId")).toString() == QLatin1String("yes"));