diff --git a/apps/opencs/model/world/commanddispatcher.cpp b/apps/opencs/model/world/commanddispatcher.cpp index f753ec2e31..13e66fd5cd 100644 --- a/apps/opencs/model/world/commanddispatcher.cpp +++ b/apps/opencs/model/world/commanddispatcher.cpp @@ -150,7 +150,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *sourceModel std::unique_ptr modifyData; std::unique_ptr modifyCell; - QAbstractItemModel *model; + QAbstractItemModel *model(nullptr); QModelIndex index; if (QAbstractProxyModel *proxy = dynamic_cast (sourceModel)) @@ -160,6 +160,8 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *sourceModel model = proxy->sourceModel(); } + if (!model) return; + int columnId = model->data (index, ColumnBase::Role_ColumnId).toInt(); int stateColumn = dynamic_cast(*model).findColumnIndex(Columns::ColumnId_Modification);