From 6128c95d085c7713f74a12bf54b60d8e99596c46 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Date: Sun, 31 May 2015 17:44:32 -0300
Subject: [PATCH 3/7] Fix off-by-one error.

i is one greater than the number of dive_sites, use the
correct nr.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
---
 qt-models/divelocationmodel.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index 164d85d..a2b5606 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -42,8 +42,8 @@ void LocationInformationModel::update()
 		endRemoveRows();
 	}
 	if (i) {
-		beginInsertRows(QModelIndex(), 0, i);
-		internalRowCount = i;
+		beginInsertRows(QModelIndex(), 0, i-1);
+		internalRowCount = i-1;
 		endInsertRows();
 	}
 }
-- 
2.3.2 (Apple Git-55)

