From 115de2a1e4794f34d0564ac2c2c534eb264bedb2 Mon Sep 17 00:00:00 2001 From: nordsoft Date: Sat, 10 Sep 2022 18:18:25 +0400 Subject: [PATCH] Fix crash with attempt to place object on non-existing map --- mapeditor/mapview.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mapeditor/mapview.cpp b/mapeditor/mapview.cpp index 0649584bf..ac3650b6a 100644 --- a/mapeditor/mapview.cpp +++ b/mapeditor/mapview.cpp @@ -70,7 +70,7 @@ void MapView::mouseMoveEvent(QMouseEvent *mouseEvent) this->update(); auto * sc = static_cast(scene()); - if(!sc) + if(!sc || !controller->map()) return; auto pos = mapToScene(mouseEvent->pos()); //TODO: do we need to check size? @@ -176,7 +176,7 @@ void MapView::mousePressEvent(QMouseEvent *event) this->update(); auto * sc = static_cast(scene()); - if(!sc) + if(!sc || !controller->map()) return; mouseStart = mapToScene(event->pos()); @@ -301,7 +301,7 @@ void MapView::mouseReleaseEvent(QMouseEvent *event) this->update(); auto * sc = static_cast(scene()); - if(!sc || !controller) + if(!sc || !controller->map()) return; switch(selectionTool)