forked from mirror/openmw-tes3mp
check if index is valid before attempting to use it
This commit is contained in:
parent
c8458654ac
commit
9ee00534b9
1 changed files with 1 additions and 1 deletions
|
@ -660,11 +660,11 @@ void CSVWorld::DialogueSubView::deleteRecord()
|
||||||
const int rows = mTable->rowCount();
|
const int rows = mTable->rowCount();
|
||||||
QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0));
|
QModelIndex currentIndex(mTable->getModelIndex(mCurrentId, 0));
|
||||||
|
|
||||||
//easier than disabling the button
|
|
||||||
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (currentIndex.row(), 1)).toInt());
|
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (currentIndex.row(), 1)).toInt());
|
||||||
bool deledetedOrErased = (state == CSMWorld::RecordBase::State_Deleted);
|
bool deledetedOrErased = (state == CSMWorld::RecordBase::State_Deleted);
|
||||||
|
|
||||||
if (!mLocked &&
|
if (!mLocked &&
|
||||||
|
currentIndex.isValid() &&
|
||||||
mTable->columnCount() > 0 &&
|
mTable->columnCount() > 0 &&
|
||||||
!deledetedOrErased &&
|
!deledetedOrErased &&
|
||||||
currentIndex.row() < rows &&
|
currentIndex.row() < rows &&
|
||||||
|
|
Loading…
Reference in a new issue