Skip to content

Commit

Permalink
Fixed crash when changing layer without a current object
Browse files Browse the repository at this point in the history
It would crash when deleting a layer, for example.
  • Loading branch information
bjorn committed Mar 6, 2017
1 parent cd87cbc commit 11f1ef9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tiled/mapdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,9 @@ void MapDocument::setCurrentLayer(Layer *layer)
mCurrentLayer = layer;
emit currentLayerChanged(mCurrentLayer);

if (mCurrentLayer && currentObject()->typeId() == Object::LayerType)
setCurrentObject(mCurrentLayer);
if (mCurrentLayer && mCurrentObject)
if (mCurrentObject->typeId() == Object::LayerType)
setCurrentObject(mCurrentLayer);
}

/**
Expand Down

0 comments on commit 11f1ef9

Please sign in to comment.