Fix use-after-free in node meta cleanup

bug introduced in 8908a9101608d3343023b470743ef63f1c44b0b7
This commit is contained in:
sfan5 2022-05-29 16:00:44 +02:00
parent a9a207685a
commit 9fc018ded1

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