Fix use-after-free in node meta cleanup

bug introduced in 8908a91016
master
sfan5 2022-05-29 16:00:44 +02:00
parent a9a207685a
commit 9fc018ded1
1 changed files with 3 additions and 1 deletions

View File

@ -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;