Fix crash if Data/splash.png is not found.
This commit is contained in:
@@ -21,8 +21,8 @@ public:
|
||||
RageFile f;
|
||||
CString data;
|
||||
|
||||
f.Open( "Data/splash.png" );
|
||||
f.Read( data );
|
||||
if( f.Open("Data/splash.png") )
|
||||
f.Read( data );
|
||||
MakeNewCocoaWindow( data.data(), data.length() );
|
||||
}
|
||||
~LoadingWindow_Cocoa() { DisposeOfCocoaWindow(); }
|
||||
|
||||
@@ -7,8 +7,14 @@ static NSTextView *text;
|
||||
void MakeNewCocoaWindow( const void *data, unsigned length )
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSData *d = [NSData dataWithBytes:data length:length];
|
||||
NSImage *image = [[[NSImage alloc] initWithData:d] autorelease];
|
||||
NSImage *image = nil;
|
||||
|
||||
if( length )
|
||||
{
|
||||
NSData *d = [NSData dataWithBytes:data length:length];
|
||||
|
||||
image = [[[NSImage alloc] initWithData:d] autorelease];
|
||||
}
|
||||
|
||||
if( !image )
|
||||
image = [NSImage imageNamed:@"splash.png"];
|
||||
|
||||
Reference in New Issue
Block a user