summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorEmmanuel Leblond <emmanuel.leblond@gmail.com>2020-05-21 18:08:48 +0200
committerEmmanuel Leblond <emmanuel.leblond@gmail.com>2021-02-25 18:01:37 +0100
commit0e4abcb77f6b5ce81824462706f8b2325bc3fed1 (patch)
tree582f3e728d776d281a4f728da2a7ee09ddf373ae /scene/main
parentee5ea64e83fc8b3a0eb1825d22fa8e6006f96b53 (diff)
Fix Godot returned status code on unexpected error
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/scene_tree.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 8bcff4409f..c93306dec8 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -54,6 +54,7 @@
#include "window.h"
#include <stdio.h>
+#include <stdlib.h>
void SceneTreeTimer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_time_left", "time"), &SceneTreeTimer::set_time_left);
@@ -538,6 +539,9 @@ void SceneTree::quit(int p_exit_code) {
// Override the exit code if a positive argument is given (the default is `-1`).
// This is a shorthand for calling `set_exit_code()` on the OS singleton then quitting.
OS::get_singleton()->set_exit_code(p_exit_code);
+ } else if (!OS::get_singleton()->is_custom_exit_code()) {
+ // Must customize exit code, otherwise it will default to a non-zero value
+ OS::get_singleton()->set_exit_code(EXIT_SUCCESS);
}
_quit = true;