diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2018-10-06 07:14:28 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2018-10-07 14:50:14 +0200 |
commit | f8020bc9766e7641fb3e53101bd6d85494e7fa41 (patch) | |
tree | 6e151a5ca1018d7ec2d9f31dd994b66cd49d3d4a | |
parent | 67177586d362a123f65d8725a2369f7cf85da66b (diff) |
Check getcwd return in X11 platform main.
-rw-r--r-- | platform/x11/godot_x11.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/platform/x11/godot_x11.cpp b/platform/x11/godot_x11.cpp index 3241cbcbf9..21148f8e86 100644 --- a/platform/x11/godot_x11.cpp +++ b/platform/x11/godot_x11.cpp @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) { setlocale(LC_CTYPE, ""); char *cwd = (char *)malloc(PATH_MAX); - getcwd(cwd, PATH_MAX); + char *ret = getcwd(cwd, PATH_MAX); Error err = Main::setup(argv[0], argc - 1, &argv[1]); if (err != OK) { @@ -55,7 +55,8 @@ int main(int argc, char *argv[]) { os.run(); // it is actually the OS that decides how to run Main::cleanup(); - chdir(cwd); + if (ret) + chdir(cwd); free(cwd); return os.get_exit_code(); |