1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-20 15:40:32 +00:00

Initialize and check pointer.

This commit is contained in:
unelsson 2021-08-12 22:31:37 +03:00
parent f1d05a93bf
commit 298db2ef76

View File

@ -150,7 +150,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *sourceModel
std::unique_ptr<CSMWorld::ModifyCommand> modifyData;
std::unique_ptr<CSMWorld::UpdateCellCommand> modifyCell;
QAbstractItemModel *model;
QAbstractItemModel *model(nullptr);
QModelIndex index;
if (QAbstractProxyModel *proxy = dynamic_cast<QAbstractProxyModel *> (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<CSMWorld::IdTable&>(*model).findColumnIndex(Columns::ColumnId_Modification);