summaryrefslogtreecommitdiff
path: root/system/pcmanfm/patches/0008-3585895-Fix-for-SIGSEGV-in-get_nearest_item-with-foc.patch
blob: 81d1c90cd42af9caf90e094f74d6568f5740587e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From f1902e6d9f5f84052f5fef93ac45180e3c6613fb Mon Sep 17 00:00:00 2001
From: Andriy Grytsenko <andrej@rep.kiev.ua>
Date: Tue, 20 Nov 2012 14:19:07 +0200
Subject: [PATCH 08/11] [#3585895]Fix for SIGSEGV in get_nearest_item() with
 focus=NULL.

---
 src/desktop.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/desktop.c b/src/desktop.c
index c960563..66201f7 100644
--- a/src/desktop.c
+++ b/src/desktop.c
@@ -1466,6 +1466,8 @@ static FmDesktopItem* get_nearest_item(FmDesktop* desktop, FmDesktopItem* item,
 
     if(!gtk_tree_model_get_iter_first(model, &it))
         return NULL;
+    if(!item) /* there is no focused item yet, select first one then */
+        return fm_folder_model_get_item_userdata(desktop->model, &it);
 
     min_x_dist = min_y_dist = (guint)-1;
     item2 = NULL;
-- 
1.8.0.1