[vlc-commits] macosx/playlist: add missing error handling

Felix Paul Kühne git at videolan.org
Fri Aug 24 20:03:43 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Aug 24 20:00:03 2012 +0200| [5feeba277311d1d3215016dc7ce1e17e79c922f1] | committer: Felix Paul Kühne

macosx/playlist: add missing error handling

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5feeba277311d1d3215016dc7ce1e17e79c922f1
---

 modules/gui/macosx/playlist.m |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index 29422dd..9d1fea5 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -1163,15 +1163,14 @@
         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 )
         {



More information about the vlc-commits mailing list