Commit a9899eb5 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCMediaList,VLCMediaListAspect: Correct the sanity check for added item.

parent fb76e3b6
......@@ -306,8 +306,8 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
int index = [[args objectForKey:@"index"] intValue];
VLCMedia * media = [args objectForKey:@"media"];
/* Sanity check */
if( index && index >= [cachedMedia count] )
index = [cachedMedia count] - 1;
if( index && index > [cachedMedia count] )
index = [cachedMedia count];
[cachedMedia insertObject:media atIndex:index];
}
[self didChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndexesInRange:range] forKey:@"media"];
......
......@@ -264,8 +264,8 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
[node setMedia:media];
[node setChildren:[self childrenAtIndex:index]];
/* Sanity check */
if( index && index >= [cachedNode count] )
index = [cachedNode count] - 1;
if( index && index > [cachedNode count] )
index = [cachedNode count];
[cachedNode insertObject:node atIndex:index];
}
[self didChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndexesInRange:range] forKey:@"node"];
......
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