summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2015-08-24 18:00:24 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2015-08-24 18:00:24 +0100
commit4bbf2ac58af4a660d108ec51867a7cf8e674cc39 (patch)
treed33c664a4ad776fd92ea7a9d4ee3e69266092cd8 /amiga
parentcba6bdb481545e404e0769b051090b16046a99f5 (diff)
downloadnetsurf-4bbf2ac58af4a660d108ec51867a7cf8e674cc39.tar.gz
netsurf-4bbf2ac58af4a660d108ec51867a7cf8e674cc39.tar.bz2
Avoid accessing NULL pointer
Diffstat (limited to 'amiga')
-rw-r--r--amiga/gui.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index f386b62d5..07fded3ef 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -346,13 +346,14 @@ bool ami_locate_resource(char *fullpath, const char *file)
/* Check NetSurf user data area first */
- strcpy(fullpath, current_user_dir);
- found = ami_gui_check_resource(fullpath, file);
- if(found) return true;
+ if(current_user_dir != NULL) {
+ strcpy(fullpath, current_user_dir);
+ found = ami_gui_check_resource(fullpath, file);
+ if(found) return true;
+ }
/* Check current theme directory */
- if(nsoption_charp(theme))
- {
+ if(nsoption_charp(theme)) {
strcpy(fullpath, nsoption_charp(theme));
found = ami_gui_check_resource(fullpath, file);
if(found) return true;
@@ -362,28 +363,23 @@ bool ami_locate_resource(char *fullpath, const char *file)
locale = OpenLocale(NULL);
- for(i=0;i<10;i++)
- {
+ for(i=0;i<10;i++) {
strcpy(fullpath,"PROGDIR:Resources/");
- if(locale->loc_PrefLanguages[i])
- {
+ if(locale->loc_PrefLanguages[i]) {
ami_gui_map_filename(&remapped, "PROGDIR:Resources",
locale->loc_PrefLanguages[i], "LangNames");
netsurf_mkpath(&fullpath, &fullpath_len, 2, fullpath, remapped);
found = ami_gui_check_resource(fullpath, file);
- }
- else
- {
+ } else {
continue;
}
if(found) break;
}
- if(!found)
- {
+ if(!found) {
/* If not found yet, check in PROGDIR:Resources/en,
* might not be in user's preferred languages */
@@ -393,8 +389,7 @@ bool ami_locate_resource(char *fullpath, const char *file)
CloseLocale(locale);
- if(!found)
- {
+ if(!found) {
/* Lastly check directly in PROGDIR:Resources */
strcpy(fullpath, "PROGDIR:Resources/");