[gnome-commander] Check if object is existing before accessing its member



commit 3ee5cb43c2c1de3c8e5ac3dba161943b469d60bf
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sun Jun 20 21:04:37 2021 +0200

    Check if object is existing before accessing its member

 src/gnome-cmd-main-win.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 657036e9e..ec2bc2b86 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -1430,8 +1430,8 @@ GnomeCmdState *GnomeCmdMainWin::get_state() const
     GnomeCmdDir *dir2 = fs2->get_directory();
 
     GnomeCmdState *state = &priv->state;
-    state->activeDirGfile = GNOME_CMD_FILE (dir1)->gFile;
-    state->inactiveDirGfile = GNOME_CMD_FILE (dir2)->gFile;
+    state->activeDirGfile = dir1 ? GNOME_CMD_FILE (dir1)->gFile : nullptr;
+    state->inactiveDirGfile = dir2 ? GNOME_CMD_FILE (dir2)->gFile : nullptr;
     state->active_dir_files = fs1->file_list()->get_visible_files();
     state->inactive_dir_files = fs2->file_list()->get_visible_files();
     state->active_dir_selected_files = fs1->file_list()->get_selected_files();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]