summaryrefslogtreecommitdiff
path: root/modules/mono/mono_gd
diff options
context:
space:
mode:
authorRaul Santos <raulsntos@gmail.com>2022-08-22 11:48:12 +0200
committerRaul Santos <raulsntos@gmail.com>2022-08-22 11:48:12 +0200
commitc56b157c61ebaa390de9e2e9763f928442cccee7 (patch)
treef9d23f63ee17b19b7d7bbbe843c16353799df07b /modules/mono/mono_gd
parent8a1e5980116355024cd7a7ce0c15db7d4ecb200a (diff)
Avoid trying to load non-existent assembly
If the project assembly does not exist, return `false` directly instead of trying to load it. This prevents the `System.InvalidOperationException` thrown for failing to locate managed application.
Diffstat (limited to 'modules/mono/mono_gd')
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index f746d63ce5..0532cc915b 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -517,6 +517,10 @@ bool GDMono::_load_project_assembly() {
.plus_file(assembly_name + ".dll");
assembly_path = ProjectSettings::get_singleton()->globalize_path(assembly_path);
+ if (!FileAccess::exists(assembly_path)) {
+ return false;
+ }
+
String loaded_assembly_path;
bool success = plugin_callbacks.LoadProjectAssemblyCallback(assembly_path.utf16(), &loaded_assembly_path);