From ec2d48a1d8c74df053e6b0bfa8faa6f2475da5a8 Mon Sep 17 00:00:00 2001 From: Quoc Le Date: Thu, 21 Mar 2024 17:44:49 +0000 Subject: [PATCH] fixed get object from metadata object --- libraries/chain/webassembly/privileged.cpp | 3 ++- libraries/chain/webassembly/runtimes/eos-vm.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/chain/webassembly/privileged.cpp b/libraries/chain/webassembly/privileged.cpp index f9a8456745..c7be046bab 100644 --- a/libraries/chain/webassembly/privileged.cpp +++ b/libraries/chain/webassembly/privileged.cpp @@ -213,7 +213,8 @@ namespace eosio { namespace chain { namespace webassembly { } bool interface::is_privileged( account_name n ) const { - return context.db.get( n ).is_privileged(); + auto const*account_metadata = context.db.find( n ); + return account_metadata != nullptr && account_metadata->is_privileged(); } void interface::set_privileged( account_name n, bool is_priv ) { diff --git a/libraries/chain/webassembly/runtimes/eos-vm.cpp b/libraries/chain/webassembly/runtimes/eos-vm.cpp index 3a41448c19..025cb19515 100644 --- a/libraries/chain/webassembly/runtimes/eos-vm.cpp +++ b/libraries/chain/webassembly/runtimes/eos-vm.cpp @@ -218,7 +218,8 @@ class eos_vm_profiling_module : public wasm_instantiated_module_interface { if(auto it = _prof.find(account); it != _prof.end()) { return it->second.get(); } else { - auto code_sequence = context.control.db().get(account).code_sequence; + auto const *account_metadata = context.control.db().find(account); + auto code_sequence = account_metadata != nullptr ? account_metadata->code_sequence : 0; std::string basename = account.to_string() + "." + std::to_string(code_sequence); auto prof = std::make_unique(basename + ".profile", *_instantiated_module); auto [pos,_] = _prof.insert(std::pair{ account, std::move(prof)});