From: Pierre d'Herbemont Date: Thu, 10 May 2007 12:24:23 +0000 (+0000) Subject: Mac OS X gui: Fix a crash when waking up from sleep. X-Git-Tag: 0.9.0-test0~7505 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=f0dc54ba5d8a5219692b5fac17fe26a4eb11eadd;p=vlc Mac OS X gui: Fix a crash when waking up from sleep. --- diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m index 144f2682a4..0d0b5450d6 100644 --- a/modules/gui/macosx/playlist.m +++ b/modules/gui/macosx/playlist.m @@ -237,15 +237,37 @@ { id o_value = nil; playlist_item_t *p_item; - - if( item == nil || ![item isKindOfClass: [NSValue class]] ) return( @"error" ); + + /* For error handling */ + static BOOL attempted_reload = NO; + + if( item == nil || ![item isKindOfClass: [NSValue class]] ) + { + /* Attempt to fix the error by asking for a data redisplay + * This might cause infinite loop, so add a small check */ + if( !attempted_reload ) + { + attempted_reload = YES; + [outlineView reloadData]; + } + return @"error" ; + } p_item = (playlist_item_t *)[item pointerValue]; - if( p_item == NULL ) + if( !p_item || !p_item->p_input ) { - return( @"error"); + /* Attempt to fix the error by asking for a data redisplay + * This might cause infinite loop, so add a small check */ + if( !attempted_reload ) + { + attempted_reload = YES; + [outlineView reloadData]; + } + return @"error"; } + attempted_reload = NO; + if( [[o_tc identifier] isEqualToString:@"1"] ) { /* sanity check to prevent the NSString class from crashing */