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

Felix Paul Kühne git at videolan.org
Sat Aug 25 13:16:03 CEST 2012


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

macosx/playlist: add missing error handling
(cherry picked from commit 5feeba277311d1d3215016dc7ce1e17e79c922f1)

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

 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 3660208..db07adb 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -1106,15 +1106,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