Skip to content

Commit 259087f

Browse files
authored
Update UnityResolve.hpp
1 parent 55fd7de commit 259087f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

UnityResolve.hpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,13 @@ class UnityResolve final {
312312

313313
class AssemblyLoad {
314314
public:
315-
AssemblyLoad(const std::string path, std::string namespaze = "MonoCsharp", std::string className = "Inject", std::string desc = "MonoCsharp.Inject:Load()") {
315+
AssemblyLoad(const std::string path, std::string namespaze = "", std::string className = "", std::string desc = "") {
316316
if (mode_ == Mode::Mono) {
317317
assembly = Invoke<void*>("mono_domain_assembly_open", pDomain, path.data());
318318
image = Invoke<void*>("mono_assembly_get_image", assembly);
319+
if (namespaze.empty() || className.empty() || desc.empty()) {
320+
return;
321+
}
319322
klass = Invoke<void*>("mono_class_from_name", image, namespaze.data(), className.data());
320323
void* entry_point_method_desc = Invoke<void*>("mono_method_desc_new", desc.data(), true);
321324
method = Invoke<void*>("mono_method_desc_search_in_class", entry_point_method_desc, klass);
@@ -812,7 +815,7 @@ class UnityResolve final {
812815
int param_count = Invoke<int>("mono_signature_get_param_count", signature);
813816
names = new char* [param_count];
814817
Invoke<void>("mono_method_get_param_names", method, names);
815-
} catch (const std::exception& e) {
818+
} catch (...) {
816819
continue;
817820
}
818821

@@ -830,18 +833,18 @@ class UnityResolve final {
830833
new Type{.address = mType, .name = Invoke<const char*>("mono_type_get_name", mType), .size = Invoke<int>("mono_type_size", mType, &t_size) }
831834
});
832835
}
833-
catch (const std::exception& e) {
836+
catch (...) {
834837

835838
}
836839
iname++;
837840
}
838841
}
839-
catch (const std::exception& e) {
842+
catch (...) {
840843
break;
841844
}
842845
} while (mType);
843846
}
844-
} catch (const std::exception& e) {
847+
} catch (...) {
845848
return;
846849
}
847850
} while (method);

0 commit comments

Comments
 (0)