summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/tankinfomodel.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/qt-models/tankinfomodel.cpp b/qt-models/tankinfomodel.cpp
index 75303d857..97f0e8010 100644
--- a/qt-models/tankinfomodel.cpp
+++ b/qt-models/tankinfomodel.cpp
@@ -28,6 +28,10 @@ bool TankInfoModel::setData(const QModelIndex &index, const QVariant &value, int
{
//WARN Seems wrong, we need to check for role == Qt::EditRole
Q_UNUSED(role);
+
+ if (index.row() < 0 || index.row() > MAX_TANK_INFO - 1)
+ return false;
+
struct tank_info_t *info = &tank_info[index.row()];
switch (index.column()) {
case DESCRIPTION:
@@ -51,7 +55,7 @@ void TankInfoModel::clear()
QVariant TankInfoModel::data(const QModelIndex &index, int role) const
{
QVariant ret;
- if (!index.isValid()) {
+ if (!index.isValid() || index.row() < 0 || index.row() > MAX_TANK_INFO - 1) {
return ret;
}
if (role == Qt::FontRole) {