Don't add cylinders and weightsystems past the MAX

We actually should disable the 'Add' button, I guess.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-05-01 14:49:17 -07:00
parent 04e59a0e1c
commit 482bea84c2
2 changed files with 8 additions and 0 deletions

View file

@ -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];