Skip to content

Commit

Permalink
fix(DaedalusVm): handle pop_instance failure gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Jan 25, 2025
1 parent cce5151 commit 2a1b554
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/DaedalusVm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,16 @@ ZkDaedalusInstance* ZkDaedalusVm_popInstance(ZkDaedalusVm* slf) {
ZKC_TRACE_FN();
ZKC_CHECK_NULL(slf);

auto instance = slf->handle.pop_instance();
if (instance == nullptr) {
return nullptr;
}

ZKC_RETURN_CATCH(new ZkDaedalusInstance(instance));
try {
auto instance = slf->handle.pop_instance();
if (instance == nullptr) {
return nullptr;
}
ZKC_RETURN_CATCH(new ZkDaedalusInstance(instance));
} catch (zenkit::DaedalusScriptError const& e) {
ZKC_LOG_ERROR("Failed to pop instance: %s", e.what());
return nullptr;
}
}

ZkDaedalusInstance* ZkDaedalusVm_getGlobalSelf(ZkDaedalusVm* slf) {
Expand Down

0 comments on commit 2a1b554

Please sign in to comment.