aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index adb1bb62a..61f39bc31 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -959,6 +959,14 @@ void DivePlannerPointsModel::setStartTime(const QTime& t)
int DivePlannerPointsModel::addStop(int meters, int minutes, const QString& gas, int ccpoint)
{
int row = divepoints.count();
+ // check if there's already a new stop before this one:
+ Q_FOREACH(const divedatapoint& dp, divepoints){
+ if (dp.time > minutes ){
+ return -1;
+ }
+ }
+
+ // add the new stop
beginInsertRows(QModelIndex(), row, row);
divedatapoint point;
point.depth = meters;