1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix use-after-free in node meta cleanup

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

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;