Skip to content

Commit 4e1d7f4

Browse files
authored
nemo-window-manage-views: fix null pointer dereference (#3492)
In case where the parent pointer is null the nemo will crash. It is the case when granting permission for my smartphone to connect using mtp.
1 parent 038925c commit 4e1d7f4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/nemo-window-manage-views.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,14 @@ viewed_file_changed_callback (NemoFile *file,
283283
/* Close window if the file it's viewing has been deleted or moved to trash. */
284284
if (nemo_file_is_gone (file) || (is_in_trash && !was_in_trash)) {
285285
NemoFile *parent;
286-
gboolean parent_is_desktop;
286+
gboolean parent_is_desktop = FALSE;
287287

288288
parent = nemo_file_get_parent (file);
289-
parent_is_desktop = nemo_file_is_desktop_directory (parent);
290-
nemo_file_unref (parent);
289+
290+
if (parent != NULL) {
291+
parent_is_desktop = nemo_file_is_desktop_directory (parent);
292+
nemo_file_unref (parent);
293+
}
291294

292295
if (slot->back_list == NULL && parent_is_desktop) {
293296
end_location_change (slot);

0 commit comments

Comments
 (0)