Skip to content

Commit d8e2a2b

Browse files
committed
Merge pull request #95005 from jsjtxietian/export-proj
Fix crash or unclear messages when exporting with invalid arguments
2 parents 4e6d962 + 1d09970 commit d8e2a2b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main/main.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -3548,13 +3548,16 @@ int Main::start() {
35483548
gdscript_docs_path = E->next()->get();
35493549
#endif
35503550
} else if (E->get() == "--export-release") {
3551+
ERR_FAIL_COND_V_MSG(!editor && !found_project, EXIT_FAILURE, "Please provide a valid project path when exporting, aborting.");
35513552
editor = true; //needs editor
35523553
_export_preset = E->next()->get();
35533554
} else if (E->get() == "--export-debug") {
3555+
ERR_FAIL_COND_V_MSG(!editor && !found_project, EXIT_FAILURE, "Please provide a valid project path when exporting, aborting.");
35543556
editor = true; //needs editor
35553557
_export_preset = E->next()->get();
35563558
export_debug = true;
35573559
} else if (E->get() == "--export-pack") {
3560+
ERR_FAIL_COND_V_MSG(!editor && !found_project, EXIT_FAILURE, "Please provide a valid project path when exporting, aborting.");
35583561
editor = true;
35593562
_export_preset = E->next()->get();
35603563
export_pack_only = true;
@@ -3566,6 +3569,8 @@ int Main::start() {
35663569
if (parsed_pair) {
35673570
E = E->next();
35683571
}
3572+
} else if (E->get().begins_with("--export-")) {
3573+
ERR_FAIL_V_MSG(EXIT_FAILURE, "Missing export preset name, aborting.");
35693574
}
35703575
#ifdef TOOLS_ENABLED
35713576
// Handle case where no path is given to --doctool.
@@ -4409,7 +4414,7 @@ bool Main::iteration() {
44094414
}
44104415

44114416
#ifdef TOOLS_ENABLED
4412-
if (wait_for_import && EditorFileSystem::get_singleton()->doing_first_scan()) {
4417+
if (wait_for_import && EditorFileSystem::get_singleton() && EditorFileSystem::get_singleton()->doing_first_scan()) {
44134418
exit = false;
44144419
}
44154420
#endif

0 commit comments

Comments
 (0)