diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/maintab.cpp | 6 | ||||
-rw-r--r-- | qt-ui/models.cpp | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index f8c69ed9c..4174ce5dd 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -61,6 +61,9 @@ void MainTab::clearStats() void MainTab::on_addCylinder_clicked() { + if (cylindersModel->rowCount() >= MAX_CYLINDERS) + return; + AddCylinderDialog dialog(this); cylinder_t *newCylinder = (cylinder_t*) malloc(sizeof(cylinder_t)); newCylinder->type.description = ""; @@ -85,6 +88,9 @@ void MainTab::on_delCylinder_clicked() void MainTab::on_addWeight_clicked() { + if (weightModel->rowCount() >= MAX_WEIGHTSYSTEMS) + return; + /* this needs a dialog - right now we just fill in a dummy */ weightsystem_t *newWeightsystem = (weightsystem_t *) malloc(sizeof(weightsystem_t)); newWeightsystem->description = "Just testing"; diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 6756002e2..f1bb8d137 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -98,6 +98,7 @@ void CylindersModel::add(cylinder_t* cyl) { if (usedRows[current_dive] >= MAX_CYLINDERS) { free(cyl); + return; } int row = usedRows[current_dive]; @@ -203,6 +204,7 @@ void WeightModel::add(weightsystem_t* weight) { if (usedRows[current_dive] >= MAX_WEIGHTSYSTEMS) { free(weight); + return; } int row = usedRows[current_dive]; |