[easytag] Check for a valid iter in Browser_Tree_Select_Dir



commit 15fc326f8eda8f3df86d31d9dd362efae66fd2de
Author: David King <amigadave amigadave com>
Date:   Mon Feb 10 20:01:49 2014 +0000

    Check for a valid iter in Browser_Tree_Select_Dir
    
    Found with Coverity (CID 1163372).

 src/browser.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/browser.c b/src/browser.c
index 4556645..39082fb 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -833,7 +833,13 @@ gboolean Browser_Tree_Select_Dir (const gchar *current_path)
     if (!Browser_Win32_Get_Drive_Root(parts[0], &parentNode, &rootPath))
         return FALSE;
 #else /* !G_OS_WIN32 */
-    gtk_tree_model_get_iter_first(GTK_TREE_MODEL(directoryTreeModel), &parentNode);
+    if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (directoryTreeModel),
+                                        &parentNode))
+    {
+        g_message ("%s", "directoryTreeModel is empty");
+        return FALSE;
+    }
+
     rootPath = gtk_tree_path_new_first();
 #endif /* !G_OS_WIN32 */
     if (rootPath)


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