changeset 36085:d3e8f4f71514

Check return value to avoid segmentation fault.
author ib
date Mon, 29 Apr 2013 11:36:53 +0000
parents 64825e4a3fed
children 6e0e3d0a36c0
files gui/dialog/url.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui/dialog/url.c	Mon Apr 29 11:21:23 2013 +0000
+++ b/gui/dialog/url.c	Mon Apr 29 11:36:53 2013 +0000
@@ -53,11 +53,15 @@
                 char *tmp;
 
                 tmp = malloc(strlen(str) + 8);
-                sprintf(tmp, "http://%s", str);
+
+                if (tmp)
+                    sprintf(tmp, "http://%s", str);
+
                 free(str);
                 str = tmp;
             }
 
+            if (str) {
             item      = calloc(1, sizeof(urlItem));
             item->url = gstrdup(str);
             listMgr(URLLIST_ITEM_ADD, item);
@@ -67,6 +71,7 @@
             add_to_gui_playlist(str, PLAYLIST_ITEM_APPEND);
             guiInfo.NewPlay = GUI_FILE_NEW;
             uiEvent(evPlay, 0);
+            }
         }
     }