Skip to content

Commit a98a467

Browse files
authored
nemo-view.c: fix crash after some shortcuts (#3525)
On action_follow_symlink_callback() and action_open_containing_folder_callback() we now confirm that exactly one thing is selected. Previously, if zero things were selected, we would segfault.
1 parent 8d48119 commit a98a467

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/nemo-view.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7208,6 +7208,12 @@ action_follow_symlink_callback (GtkAction *action,
72087208

72097209
view = NEMO_VIEW (callback_data);
72107210
selection = nemo_view_get_selection (view);
7211+
7212+
if (g_list_length (selection) != 1) {
7213+
nemo_file_list_free (selection);
7214+
return;
7215+
}
7216+
72117217
if (nemo_file_is_symbolic_link (selection->data)) {
72127218
gchar *uri = nemo_file_get_symbolic_link_target_uri (selection->data);
72137219
gchar *view_uri = nemo_view_get_uri (view);
@@ -7253,6 +7259,11 @@ action_open_containing_folder_callback (GtkAction *action,
72537259
view = NEMO_VIEW (callback_data);
72547260
selection = nemo_view_get_selection (view);
72557261

7262+
if (g_list_length (selection) != 1) {
7263+
nemo_file_list_free (selection);
7264+
return;
7265+
}
7266+
72567267
item = NEMO_FILE (selection->data);
72577268
activation_location = nemo_file_get_activation_location (item);
72587269
activation_file = nemo_file_get (activation_location);

0 commit comments

Comments
 (0)