fix: Fix potential NPE in SelectionOverlay
This commit is contained in:
parent
c2b5cf3d39
commit
1b95b443dc
1 changed files with 6 additions and 1 deletions
|
@ -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: {
|
||||
|
|
Loading…
Reference in a new issue