Commit 0eca783f authored by Petri Hintukainen's avatar Petri Hintukainen

Check for null

parent 3c43b555
......@@ -52,6 +52,10 @@ int file_mkdirs(const char *path)
char *end = dir;
char *p;
if (!dir) {
return -1;
}
/* strip file name */
if (!(end = strrchr(end, DIR_SEP_CHAR))) {
X_FREE(dir);
......
......@@ -212,7 +212,13 @@ static void *_load_jvm(const char **p_java_home)
static int _can_read_file(const char *fn)
{
FILE *fp = fopen(fn, "rb");
FILE *fp;
if (!fn) {
return 0;
}
fp = fopen(fn, "rb");
if (fp) {
char b;
int result = (int)fread(&b, 1, 1, fp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment