From 8a239899d34f6605839807d41d874b9e7f5f46c4 Mon Sep 17 00:00:00 2001 From: Diego Iastrubni Date: Sat, 1 Feb 2025 18:22:44 +0200 Subject: [PATCH] TextEditorPlugin: theme in config might be empty If the theme is "", code can be simplified (do nothing). Before it tried opening a null file and fail. This would add a warning on the console. --- src/plugins/texteditor/texteditor_plg.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/texteditor/texteditor_plg.cpp b/src/plugins/texteditor/texteditor_plg.cpp index ee12d89..50147ec 100644 --- a/src/plugins/texteditor/texteditor_plg.cpp +++ b/src/plugins/texteditor/texteditor_plg.cpp @@ -280,13 +280,14 @@ void TextEditorPlugin::loadConfig(QSettings &settings) { auto themeFileName = getConfig().getTheme(); delete this->theme; - this->theme = new Qutepart::Theme(); - if (!this->theme->loadTheme(themeFileName)) { - qDebug() << "Failed loading thene " << themeFileName; - delete this->theme; - this->theme = nullptr; + if (!themeFileName.isEmpty()) { + this->theme = new Qutepart::Theme(); + if (!this->theme->loadTheme(themeFileName)) { + qDebug() << "Failed loading theme " << themeFileName; + delete this->theme; + this->theme = nullptr; + } } - auto history = getConfig().getSeachHistory(); historyModel->setHistory(history); }