summaryrefslogtreecommitdiffstats
path: root/qt-models/divelocationmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models/divelocationmodel.cpp')
-rw-r--r--qt-models/divelocationmodel.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index abdf69f91..ff733f5ad 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -188,8 +188,13 @@ bool filter_same_gps_cb (QAbstractItemModel *model, int sourceRow, const QModelI
{
int ref_lat = displayed_dive_site.latitude.udeg;
int ref_lon = displayed_dive_site.longitude.udeg;
- QModelIndex curr = model->index(sourceRow, LocationInformationModel::UUID, parent.isValid() ? parent : QModelIndex());
+ QSortFilterProxyModel *self = (QSortFilterProxyModel*) model;
+
+ int ds_uuid = self->sourceModel()->index(sourceRow, LocationInformationModel::UUID, parent).data().toInt();
+ struct dive_site *ds = get_dive_site_by_uuid(ds_uuid);
+
+ if (!ds)
+ return false;
- struct dive_site *ds = get_dive_site_by_uuid(curr.data().toInt());
return (ds->latitude.udeg == ref_lat && ds->longitude.udeg == ref_lon);
} \ No newline at end of file