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