Skip to content

Commit

Permalink
Fix use-after-free in node meta cleanup
Browse files Browse the repository at this point in the history
bug introduced in 8908a91
  • Loading branch information
sfan5 committed May 29, 2022
1 parent a9a2076 commit 9fc018d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/script/lua_api/l_nodemeta.cpp
Expand Up @@ -66,8 +66,10 @@ void NodeMetaRef::reportMetadataChange(const std::string *name)
NodeMetadata *meta = dynamic_cast<NodeMetadata*>(getmeta(false));

// If the metadata is now empty, get rid of it
if (meta && meta->empty())
if (meta && meta->empty()) {
clearMeta();
meta = nullptr;
}

MapEditEvent event;
event.type = MEET_BLOCK_NODE_METADATA_CHANGED;
Expand Down

0 comments on commit 9fc018d

Please sign in to comment.