projects
/
neverball
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Check config_file arguments for NULL
[neverball]
/
share
/
base_config.c
diff --git
a/share/base_config.c
b/share/base_config.c
index
721a2d5
..
6df2fae
100644
(file)
--- a/
share/base_config.c
+++ b/
share/base_config.c
@@
-12,7
+12,6
@@
* General Public License for more details.
*/
* General Public License for more details.
*/
-#include <SDL.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@
-46,11
+45,11
@@
static const char *config_file(const char *path, const char *file)
{
static char absolute[MAXSTR];
{
static char absolute[MAXSTR];
- size_t d = strlen(path);
+ size_t d = path ? strlen(path) : 0;
- strncpy(absolute, path, MAXSTR - 1);
+ strncpy(absolute, path ? path : "", MAXSTR - 1);
strncat(absolute, "/", MAXSTR - d - 1);
strncat(absolute, "/", MAXSTR - d - 1);
- strncat(absolute, file, MAXSTR - d - 2);
+ strncat(absolute, file ? file : "", MAXSTR - d - 2);
return absolute;
}
return absolute;
}
@@
-104,7
+103,7
@@
int config_data_path(const char *path, const char *file)
return 1;
}
return 1;
}
- if (CONFIG_DATA && config_test(CONFIG_DATA, file))
+ if (config_test(CONFIG_DATA, file))
{
strncpy(data_path, CONFIG_DATA, MAXSTR);
return 1;
{
strncpy(data_path, CONFIG_DATA, MAXSTR);
return 1;