Commit 40198b57 authored by Felix Paul Kühne's avatar Felix Paul Kühne

VLCMediaList: fix exception if list is empty

parent dc7fe584
......@@ -3,9 +3,11 @@
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 VLC authors and VideoLAN
* Copyright (C) 2009, 2013 Felix Paul Khne
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
* Felix Paul Khne <fkuehne # videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
......@@ -136,15 +138,19 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (void)removeMediaAtIndex:(NSInteger)index
{
[cachedMedia removeObjectAtIndex:index];
if (index < [cachedMedia count]) {
[cachedMedia removeObjectAtIndex:index];
// Remove it from the libvlc's medialist
libvlc_media_list_remove_index(p_mlist, index);
// Remove it from the libvlc's medialist
libvlc_media_list_remove_index(p_mlist, index);
}
}
- (VLCMedia *)mediaAtIndex:(NSInteger)index
{
return [cachedMedia objectAtIndex:index];
if (index < [cachedMedia count])
return [cachedMedia objectAtIndex:index];
return NULL;
}
- (NSInteger)indexOfMedia:(VLCMedia *)media
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment