Skip to content

Commit

Permalink
Merge pull request #36868 from Calinou/improve-cli-script-error-message
Browse files Browse the repository at this point in the history
Tweak the error message when trying to run an invalid script from CLI
  • Loading branch information
akien-mga authored Apr 16, 2020
2 parents 45a036f + 2ab9515 commit 30ab5c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,15 +1675,15 @@ bool Main::start() {
return false;
}

if (script_res->can_instance() /*&& script_res->inherits_from("SceneTreeScripted")*/) {
if (script_res->can_instance()) {

StringName instance_type = script_res->get_instance_base_type();
Object *obj = ClassDB::instance(instance_type);
MainLoop *script_loop = Object::cast_to<MainLoop>(obj);
if (!script_loop) {
if (obj)
memdelete(obj);
ERR_FAIL_V_MSG(false, "Can't load script '" + script + "', it does not inherit from a MainLoop type.");
ERR_FAIL_V_MSG(false, vformat("Can't load the script \"%s\" as it doesn't inherit from SceneTree or MainLoop.", script));
}

script_loop->set_init_script(script_res);
Expand Down

0 comments on commit 30ab5c9

Please sign in to comment.