]> git.sesse.net Git - vlc/commitdiff
macosx/playlist: add missing error handling
authorFelix Paul Kühne <fkuehne@videolan.org>
Fri, 24 Aug 2012 18:00:03 +0000 (20:00 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Fri, 24 Aug 2012 18:00:03 +0000 (20:00 +0200)
modules/gui/macosx/playlist.m

index 29422dd2b083181a598ce09cc1050f5ebe70accd..9d1fea508f134e2a7140769df94b4bac9ef42820 100644 (file)
         o_one_item = [o_array objectAtIndex: i_item];
         p_input = [self createItem: o_one_item];
         if( !p_input )
-        {
             continue;
-        }
 
         /* Add the item */
-        /* FIXME: playlist_AddInput() can fail */
-
-        playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT, i_position == -1 ? PLAYLIST_END : i_position + i_item, b_usingPlaylist,
-         pl_Locked );
+        int returnValue = playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT, i_position == -1 ? PLAYLIST_END : i_position + i_item, b_usingPlaylist, pl_Locked );
+        if (returnValue != VLC_SUCCESS) {
+            vlc_gc_decref( p_input );
+            continue;
+        }
 
         if( i_item == 0 && !b_enqueue )
         {