1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 09:15:35 +00:00

Count of nested columns can be retrieved for a collection with no records

This commit is contained in:
Stanislav Bas 2015-07-05 15:36:41 +03:00 committed by cc9cii
parent 27c9eaeffc
commit fb395e4dc9

View file

@ -161,8 +161,19 @@ namespace CSMWorld
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>
int NestedIdCollection<ESXRecordT, IdAccessorT>::getNestedColumnsCount(int row, int column) const int NestedIdCollection<ESXRecordT, IdAccessorT>::getNestedColumnsCount(int row, int column) const
{ {
return getAdapter(Collection<ESXRecordT, IdAccessorT>::getColumn(column)).getColumnsCount( const ColumnBase &nestedColumn = Collection<ESXRecordT, IdAccessorT>::getColumn(column);
Collection<ESXRecordT, IdAccessorT>::getRecord(row)); int numRecords = Collection<ESXRecordT, IdAccessorT>::getSize();
if (row >= 0 && row < numRecords)
{
const Record<ESXRecordT>& record = Collection<ESXRecordT, IdAccessorT>::getRecord(row);
return getAdapter(nestedColumn).getColumnsCount(record);
}
else
{
// If the row is invalid (or there no records), retrieve the column count using a blank record
const Record<ESXRecordT> record;
return getAdapter(nestedColumn).getColumnsCount(record);
}
} }
template<typename ESXRecordT, typename IdAccessorT> template<typename ESXRecordT, typename IdAccessorT>