Skip to content

Commit 7ca8863

Browse files
committed
fix(DaedaluScript): add more better error handling
1 parent 0887eb1 commit 7ca8863

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/DaedalusScript.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "zenkit-capi/DaedalusScript.h"
44
#include "Internal.hh"
55

6+
#include <exception>
67
#include <zenkit/addon/daedalus.hh>
78

89
ZKC_LOADER(ZkDaedalusScript)
@@ -106,8 +107,9 @@ ZkDaedalusInstance* ZkDaedalusSymbol_getInstance(ZkDaedalusSymbol* slf) {
106107

107108
try {
108109
auto& instance = slf->get_instance();
110+
if (instance == nullptr) return nullptr;
109111
return new ZkDaedalusInstance(instance);
110-
} catch (std::runtime_error& e) {
112+
} catch (std::exception& e) {
111113
return nullptr;
112114
}
113115
}
@@ -193,6 +195,9 @@ ZkDaedalusDataType ZkDaedalusSymbol_getReturnType(ZkDaedalusSymbol const* slf) {
193195
}
194196

195197
ZKC_API ZkDaedalusInstanceType ZkDaedalusInstance_getType(ZkDaedalusInstance const* slf) {
198+
ZKC_TRACE_FN();
199+
ZKC_CHECK_NULL(slf);
200+
196201
auto type = SLF->instance_type();
197202

198203
if (type == &typeid(zenkit::IGuildValues)) return ZkDaedalusInstanceType_GuildValues;

0 commit comments

Comments
 (0)