mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-18 17:40:48 +02:00
Fix crash with attempt to place object on non-existing map
This commit is contained in:
parent
371404df98
commit
115de2a1e4
@ -70,7 +70,7 @@ void MapView::mouseMoveEvent(QMouseEvent *mouseEvent)
|
||||
this->update();
|
||||
|
||||
auto * sc = static_cast<MapScene*>(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<MapScene*>(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<MapScene*>(scene());
|
||||
if(!sc || !controller)
|
||||
if(!sc || !controller->map())
|
||||
return;
|
||||
|
||||
switch(selectionTool)
|
||||
|
Loading…
Reference in New Issue
Block a user