diff --git a/src/tiled/mapdocument.cpp b/src/tiled/mapdocument.cpp index f3534f3959..4828b55316 100644 --- a/src/tiled/mapdocument.cpp +++ b/src/tiled/mapdocument.cpp @@ -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); } /**