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