[easytag] Check iter in Browser_Tree_Rename_Directory



commit 16a66debb404726c34331c6159e32bf99ff107a5
Author: David King <amigadave amigadave com>
Date:   Mon Feb 10 20:06:06 2014 +0000

    Check iter in Browser_Tree_Rename_Directory
    
    Found with Coverity (CID 1163371).

 src/browser.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/browser.c b/src/browser.c
index 39082fb..c88eba1 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -2570,8 +2570,17 @@ Browser_Tree_Rename_Directory (const gchar *last_path, const gchar *new_path)
 
     for (i = 1; textsplit[i] != NULL; i++)
     {
-        gtk_tree_model_get_iter(GTK_TREE_MODEL(directoryTreeModel), &iter, parentpath);
-        childpath = Find_Child_Node(&iter, textsplit[i]);
+        gboolean valid = gtk_tree_model_get_iter (GTK_TREE_MODEL (directoryTreeModel),
+                                                  &iter, parentpath);
+        if (valid)
+        {
+            childpath = Find_Child_Node (&iter, textsplit[i]);
+        }
+        else
+        {
+            childpath = NULL;
+        }
+
         if (childpath == NULL)
         {
             // ERROR! Could not find it!


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