summaryrefslogtreecommitdiffstats
path: root/qt-models/cylindermodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models/cylindermodel.cpp')
-rw-r--r--qt-models/cylindermodel.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index b1ce0be24..350d15aa4 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -273,7 +273,10 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
break;
case USE:
if (CHANGED()) {
- cyl->cylinder_use = (enum cylinderuse)vString.toInt();
+ int use = vString.toInt();
+ if (use > NUM_GAS_USE - 1 || use < 0)
+ use = 0;
+ cyl->cylinder_use = (enum cylinderuse)use;
changed = true;
}
break;