From 156bdc3b8d11d85851c867c5c681f287d9284a87 Mon Sep 17 00:00:00 2001 From: Mike Massonnet Date: Thu, 7 Jan 2010 00:21:39 +0100 Subject: [PATCH] Fix possible NULL values (bug #6119 #6120) As reported in xfce4-clipman there is a possible crash when the default cache is used to restore content or fill the selection while it is NULL. --- xfce4-settings-helper/clipboard-manager.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xfce4-settings-helper/clipboard-manager.c b/xfce4-settings-helper/clipboard-manager.c index cf23f25..d214dbe 100644 --- a/xfce4-settings-helper/clipboard-manager.c +++ b/xfce4-settings-helper/clipboard-manager.c @@ -136,7 +136,7 @@ xfce_clipboard_manager_default_get_func (GtkClipboard *clipboard, list = manager->default_cache; - for (; list->next != NULL; list = list->next) + for (; list != NULL && list->next != NULL; list = list->next) { selection_data_cache = list->data; @@ -178,9 +178,13 @@ xfce_clipboard_manager_default_restore (XfceClipboardManager *manager) g_return_if_fail (XFCE_IS_CLIPBOARD_MANAGER (manager)); + list = manager->default_cache; + if (list == NULL) + return; + target_list = gtk_target_list_new (NULL, 0); - for (list = manager->default_cache; list->next != NULL; list = list->next) + for (; list->next != NULL; list = list->next) { sdata = list->data; gtk_target_list_add (target_list, -- 1.6.6