From 119b17ac75030420793ac3c0f2a9fd090e989e78 Mon Sep 17 00:00:00 2001 From: EvilSpirit Date: Fri, 20 Jan 2017 10:12:45 +0700 Subject: [PATCH] Fix an occasional crash when starting to drag an entity. --- src/mouse.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mouse.cpp b/src/mouse.cpp index 1b6c3f08..41edcea9 100644 --- a/src/mouse.cpp +++ b/src/mouse.cpp @@ -72,7 +72,12 @@ void GraphicsWindow::StartDraggingBySelection() { // The user might select a point, and then click it again to start // dragging; but the point just got unselected by that click. So drag // the hovered item too, and they'll always have it. - if(hover.entity.v) StartDraggingByEntity(ChooseFromHoverToDrag().entity); + if(hover.entity.v) { + hEntity dragEntity = ChooseFromHoverToDrag().entity; + if(dragEntity.v != Entity::NO_ENTITY.v) { + StartDraggingByEntity(dragEntity); + } + } } void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,