fix: Fix potential NPE in SelectionOverlay

This commit is contained in:
Vsevolod Kremianskii 2020-11-16 20:05:04 +07:00
parent c2b5cf3d39
commit 1b95b443dc

View file

@ -105,7 +105,12 @@ bool SelectionOverlay::handleMouseButtonDown(const SDL_MouseButtonEvent &event)
shared_ptr<Area> area(_game->module()->area());
ObjectSelector &selector = area->objectSelector();
shared_ptr<SpatialObject> object(area->find(selector.selectedObjectId()));
int selectedObjectId = selector.selectedObjectId();
if (selectedObjectId == -1) return false;
shared_ptr<SpatialObject> object(area->find(selectedObjectId));
if (!object) return false;
switch (_actions[_selectedActionIdx]) {
case ContextualAction::Unlock: {