From 244f0b228fefb69fb59c1f7f70d4815c0388a634 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 28 Dec 2019 22:18:41 -0300 Subject: [PATCH] Fix M_PathParts instead --- src/m_misc.c | 2 ++ src/sdl/i_main.c | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index 5f75aae92..83c0c7bec 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2457,6 +2457,8 @@ int M_PathParts(const char *path) int n; const char *p; const char *t; + if (path == NULL) + return 0; for (n = 0, p = path ;; ++n) { t = p; diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 8a4fa06b5..5d0009927 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -197,12 +197,9 @@ int main(int argc, char **argv) format, timeinfo); } - if (logdir) - { - M_MkdirEachUntil(logfilename, - M_PathParts(logdir) - 1, - M_PathParts(logfilename) - 1, 0755); - } + M_MkdirEachUntil(logfilename, + M_PathParts(logdir) - 1, + M_PathParts(logfilename) - 1, 0755); #ifdef __unix__ logstream = fopen(logfilename, "w");