[Xfce4-commits] <xfburn:master> Avoid adding empty strings created by g_strsplit

David Mohr noreply at xfce.org
Sat Sep 26 07:18:05 CEST 2009


Updating branch refs/heads/master
         to 7954cdc1867a22a6f145a0a74966aab7e00f38cf (commit)
       from c10597ce29ba0d40c62b8df1d4c0966da3bf3917 (commit)

commit 7954cdc1867a22a6f145a0a74966aab7e00f38cf
Author: David Mohr <squisher at xfce.org>
Date:   Fri Sep 25 23:16:56 2009 -0600

    Avoid adding empty strings created by g_strsplit

 xfburn/xfburn-audio-composition.c |    5 +++--
 xfburn/xfburn-data-composition.c  |    4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/xfburn/xfburn-audio-composition.c b/xfburn/xfburn-audio-composition.c
index 34edf8b..6a9d014 100644
--- a/xfburn/xfburn-audio-composition.c
+++ b/xfburn/xfburn-audio-composition.c
@@ -1342,7 +1342,7 @@ thread_add_files_action (ThreadAddFilesActionParams *params)
   files = g_strsplit (priv->selected_files, "\n", -1);
 
   if (files)
-    for (i=0; files[i] != NULL; i++) {
+    for (i=0; files[i] != NULL && files[i][0] != '\0'; i++) {
       GtkTreeIter iter;
       gchar *full_path = NULL;
       
@@ -1704,8 +1704,9 @@ cb_content_drag_data_rcv (GtkWidget * widget, GdkDragContext * dc, guint x, guin
     full_paths = (gchar *) gtk_selection_data_get_text (sd);
 
     files = g_strsplit ((gchar *) full_paths, "\n", -1);
+
     if (files)
-      for (i=0; files[i] != NULL; i++) {
+      for (i=0; files[i] != NULL && files[i][0] != '\0'; i++) {
         gchar *full_path;
 
 #ifdef HAVE_THUNAR_VFS
diff --git a/xfburn/xfburn-data-composition.c b/xfburn/xfburn-data-composition.c
index b4f1477..54c1a97 100644
--- a/xfburn/xfburn-data-composition.c
+++ b/xfburn/xfburn-data-composition.c
@@ -1316,7 +1316,7 @@ thread_add_files_action (ThreadAddFilesActionParams *params)
   files = g_strsplit (priv->selected_files, "\n", -1);
 
   if (files)
-    for (i=0; files[i] != NULL; i++) {
+    for (i=0; files[i] != NULL && files[i][0] != '\0'; i++) {
       GtkTreeIter iter;
       gchar *full_path = NULL;
       
@@ -1668,7 +1668,7 @@ cb_content_drag_data_rcv (GtkWidget * widget, GdkDragContext * dc, guint x, guin
 
     if (files) {
 
-      for (i=0; files[i] != NULL; i++) {
+      for (i=0; files[i] != NULL && files[i][0] != '\0'; i++) {
         gchar *full_path;
 
 #ifdef HAVE_THUNAR_VFS



More information about the Xfce4-commits mailing list