From 95db639603e9adbd5403ff734695e9ce41593efa Mon Sep 17 00:00:00 2001 From: mathieu _alkama_ m Date: Sun, 13 Dec 2015 13:17:44 +0100 Subject: [PATCH] Fix: Setup "self" (from super initialisation) before accessing any attribute --- ogl_editor/src/macosx/FileDialog.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ogl_editor/src/macosx/FileDialog.m b/ogl_editor/src/macosx/FileDialog.m index 6697592..f6b1f8f 100644 --- a/ogl_editor/src/macosx/FileDialog.m +++ b/ogl_editor/src/macosx/FileDialog.m @@ -69,10 +69,12 @@ int Dialog_save(char* dest) - (id)init { - [super init]; - m_bIsClosed = false; - - return self; + if ( self = [super init] ) { + m_bIsClosed = false; + return self; + } + else + return nil; } - (BOOL)windowShouldClose:(id)sender @@ -145,7 +147,7 @@ void Dialog_showColorPicker(uint32_t* color) void Dialog_showError(const text_t* text) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - NSString* message = [[[NSString alloc] initWithUTF8String:text] autorelease];// convert + NSString* message = [[[NSString alloc] initWithUTF8String:text] autorelease];// convert NSRunAlertPanel(@"Error", message, @"Ok", @"", @"");