diff --git a/src/setup.c b/src/setup.c index 23ec35b7..17e4b47f 100644 --- a/src/setup.c +++ b/src/setup.c @@ -85,12 +85,15 @@ char * Get_program_directory(const char * argv0) // MacOSX #if defined(__macosx__) program_dir = malloc(MAXPATHLEN); - CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); - (void)argv0; // unused - CFURLGetFileSystemRepresentation(url,true,(UInt8*)program_dir,MAXPATHLEN); - CFRelease(url); - // Append trailing slash - strcat(program_dir ,"/"); + if (program_dir != NULL) + { + CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + (void)argv0; // unused + CFURLGetFileSystemRepresentation(url,true,(UInt8*)program_dir,MAXPATHLEN); + CFRelease(url); + // Append trailing slash + strcat(program_dir ,"/"); + } // AmigaOS and alike: hard-coded volume name. #elif defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) diff --git a/src/text.c b/src/text.c index 7127300d..a342ab82 100644 --- a/src/text.c +++ b/src/text.c @@ -360,7 +360,7 @@ void Init_text(void) #elif defined(__macosx__) // Récupération de la liste des fonts avec fontconfig #ifndef NOTTF - + { int i,number; char * home_dir = NULL; @@ -383,6 +383,7 @@ void Init_text(void) free(home_dir); //CFRelease(url); + } #endif #elif defined(__CAANOO__) || defined(__WIZ__) || defined(__GP2X__) @@ -805,4 +806,4 @@ byte *Render_text(const char *str, int font_number, int size, int antialias, int { return Render_text_SFont(str, font_number, width, height, palette); } -} \ No newline at end of file +}