diff options
Diffstat (limited to 'src/libui_sdl')
-rw-r--r-- | src/libui_sdl/main.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 4f0d278..6cdfe7a 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -1575,9 +1575,17 @@ int main(int argc, char** argv) if (argv[0][len] == '\\') break; len--; } - EmuDirectory = new char[len]; - strncpy(EmuDirectory, argv[0], len); - EmuDirectory[len] = '\0'; + if (len > 0) + { + EmuDirectory = new char[len]; + strncpy(EmuDirectory, argv[0], len); + EmuDirectory[len] = '\0'; + } + else + { + EmuDirectory = new char[2]; + strcpy(EmuDirectory, "."); + } } else { |