summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemPainting.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Items/ItemPainting.h')
-rw-r--r--src/Items/ItemPainting.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Items/ItemPainting.h b/src/Items/ItemPainting.h
index 3432583ca..8e5a1b5d2 100644
--- a/src/Items/ItemPainting.h
+++ b/src/Items/ItemPainting.h
@@ -70,11 +70,10 @@ public:
{ "BurningSkull" }
};
- cPainting * Painting = new cPainting(gPaintingTitlesList[a_World->GetTickRandomNumber(ARRAYCOUNT(gPaintingTitlesList) - 1)].Title, a_BlockFace, a_BlockX, a_BlockY, a_BlockZ);
- if (!Painting->Initialize(*a_World))
+ auto Painting = cpp14::make_unique<cPainting>(gPaintingTitlesList[a_World->GetTickRandomNumber(ARRAYCOUNT(gPaintingTitlesList) - 1)].Title, a_BlockFace, a_BlockX, a_BlockY, a_BlockZ);
+ auto PaintingPtr = Painting.get();
+ if (!PaintingPtr->Initialize(std::move(Painting), *a_World))
{
- delete Painting;
- Painting = nullptr;
return false;
}