Fix memory leak

This commit is contained in:
GriffinR 2022-06-29 18:37:53 -04:00 committed by t
parent 73eabc92ca
commit c1e3415417

View file

@ -860,8 +860,10 @@ void TilesetEditor::on_actionPaste_triggered()
{
Metatile *prevMetatile = new Metatile(*this->metatile);
uint16_t metatileId = this->getSelectedMetatileId();
if (!this->replaceMetatile(metatileId, this->copiedMetatile))
if (!this->replaceMetatile(metatileId, this->copiedMetatile)) {
delete prevMetatile;
return;
}
MetatileHistoryItem *commit = new MetatileHistoryItem(metatileId, prevMetatile, new Metatile(*this->metatile));
metatileHistory.push(commit);