Skip to content

Commit

Permalink
fixed get object from metadata object
Browse files Browse the repository at this point in the history
  • Loading branch information
quocle108 committed Mar 21, 2024
1 parent b460190 commit 9482df4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion libraries/chain/webassembly/privileged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ namespace eosio { namespace chain { namespace webassembly {
}

bool interface::is_privileged( account_name n ) const {
return context.db.get<account_metadata_object, by_name>( n ).is_privileged();
auto const*account_metadata = context.db.find<account_metadata_object, by_name>( n );
return account_metadata != nullptr && account_metadata->is_privileged();
}

void interface::set_privileged( account_name n, bool is_priv ) {
Expand Down
3 changes: 2 additions & 1 deletion libraries/chain/webassembly/runtimes/eos-vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_metadata_object, by_name>(account).code_sequence;
auto const *account_metadata = context.control.db().find<account_metadata_object, by_name>(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<profile_data>(basename + ".profile", *_instantiated_module);
auto [pos,_] = _prof.insert(std::pair{ account, std::move(prof)});
Expand Down

0 comments on commit 9482df4

Please sign in to comment.