From 60aca425a0f2a745f97b6a3823e873ca80b85282 Mon Sep 17 00:00:00 2001 From: Leonardo Zide Date: Sat, 1 Feb 2020 10:58:19 -0800 Subject: [PATCH] Fixed crash using undo while dragging a new part. --- common/view.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/view.cpp b/common/view.cpp index c2f2cae7..6daa4b8d 100644 --- a/common/view.cpp +++ b/common/view.cpp @@ -1976,8 +1976,11 @@ void View::EndDrag(bool Accept) break; case lcDragState::PIECE: - ActiveModel->InsertPieceToolClicked(GetPieceInsertPosition(false, gMainWindow->GetCurrentPieceInfo())); - break; + { + PieceInfo* Info = gMainWindow->GetCurrentPieceInfo(); + if (Info) + ActiveModel->InsertPieceToolClicked(GetPieceInsertPosition(false, Info)); + } break; case lcDragState::COLOR: ActiveModel->PaintToolClicked(FindObjectUnderPointer(true, false).Object);