[graphics/kuickshow] src: KuickShow: Only save state of "kuick_one_window" if the action exists

Jonathan Marten <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit dba120a0c92d634d0e52e8de2611c9b84faf288e by Jonathan Marten.
Committed on 06/08/2026 at 18:22.
Pushed by marten into branch 'master'.

KuickShow: Only save state of "kuick_one_window" if the action exists

M  +6    -4    src/kuickshow.cpp

https://invent.kde.org/graphics/kuickshow/-/commit/dba120a0c92d634d0e52e8de2611c9b84faf288e

diff --git a/src/kuickshow.cpp b/src/kuickshow.cpp
index 6eb8f02..ddd8b82 100644
--- a/src/kuickshow.cpp
+++ b/src/kuickshow.cpp
@@ -974,7 +974,7 @@ void KuickShow::readProperties( const KConfigGroup& kc )
 
 void KuickShow::saveProperties( KConfigGroup& kc )
 {
-    kc.writeEntry( "Browser visible", fileWidget && fileWidget->isVisible() );
+    kc.writeEntry( "Browser visible", fileWidget!=nullptr && fileWidget->isVisible() );
     if (fileWidget)
     kc.writePathEntry( "CurrentDirectory", fileWidget->url().url() );
 
@@ -999,11 +999,13 @@ void KuickShow::saveSettings()
 {
     KSharedConfig::Ptr kc = KSharedConfig::openConfig();
     KConfigGroup sessGroup(kc, "SessionSettings");
-    // TODO: action may have been destroyed before we get here
-    if(auto oneWindowAction = kuickAction("kuick_one_window"))
-        sessGroup.writeEntry( "OpenImagesInActiveWindow", oneWindowAction->isChecked() );
 
     if ( fileWidget ) {
+        // This action will only exist if there is a FileWidget
+        auto *oneWindowAction = kuickAction("kuick_one_window");
+        if (oneWindowAction!=nullptr)
+            sessGroup.writeEntry( "OpenImagesInActiveWindow", oneWindowAction->isChecked() );
+
         sessGroup.writePathEntry( "CurrentDirectory", fileWidget->url().toDisplayString() );
         KConfigGroup group( kc, "Filebrowser" );
         fileWidget->writeConfig( group);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.