diff options
| author | Ignacio Etcheverry | 2018-04-24 20:42:31 +0200 |
|---|---|---|
| committer | Hein-Pieter van Braam | 2018-04-28 22:59:25 +0200 |
| commit | 58918b629d0b9462b1c3ae486ee51e14b935890a (patch) | |
| tree | 7a9651952c9e76fd9143f0730348d0f3cac1db07 /modules/mono/csharp_script.cpp | |
| parent | 736d8db0079b484b1f21819dd351a50e2ed0e0bc (diff) | |
| download | godot-58918b629d0b9462b1c3ae486ee51e14b935890a.tar.gz godot-58918b629d0b9462b1c3ae486ee51e14b935890a.tar.zst godot-58918b629d0b9462b1c3ae486ee51e14b935890a.zip | |
Diffstat (limited to 'modules/mono/csharp_script.cpp')
| -rw-r--r-- | modules/mono/csharp_script.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 254079820..adc5f16f9 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -1954,8 +1954,12 @@ Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Variant::Call ScriptInstance *CSharpScript::instance_create(Object *p_this) { - if (!valid) - return NULL; + if (!script_class) { + ERR_EXPLAIN("Cannot find class " + name + " for script " + get_path()); + ERR_FAIL_V(NULL); + } + + ERR_FAIL_COND_V(!valid, NULL); if (!tool && !ScriptServer::is_scripting_enabled()) { #ifdef TOOLS_ENABLED @@ -2045,20 +2049,15 @@ Error CSharpScript::reload(bool p_keep_state) { if (project_assembly) { script_class = project_assembly->get_object_derived_class(name); - if (!script_class) { - ERR_PRINTS("Cannot find class " + name + " for script " + get_path()); - } + valid = script_class != NULL; + + if (script_class) { #ifdef DEBUG_ENABLED - else if (OS::get_singleton()->is_stdout_verbose()) { OS::get_singleton()->print(String("Found class " + script_class->get_namespace() + "." + script_class->get_name() + " for script " + get_path() + "\n") .utf8()); - } #endif - valid = script_class != NULL; - - if (script_class) { tool = script_class->has_attribute(CACHED_CLASS(ToolAttribute)); native = GDMonoUtils::get_class_native_base(script_class); |
