From e8b3fdb4a6936c1130395e039963839d64f2b396 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 27 Oct 2018 15:18:29 +0200 Subject: Dive site: compare pointers in MultiFilterSortModel::showDive() To test whether to show a dive, the UUIDs of the filtered-by location and the dive-site of a dive were compared. Since UUIDs are unique (as the name implies), directly compare pointers. Note: this code comes from a time when the filtered-by location was not a pointer, but a copy. Moreover, the if tested first for the same name, then (logical-or) for the same uuid. This makes no sense, as the same dive-site implies the same name. This code likewise can be explained by historic reasons: the filtered-by location may have contained a different name. Swap the order of the conditions: first test for the same object and only of the objects differ, test for the same same. Signed-off-by: Berthold Stoeger --- qt-models/filtermodels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qt-models/filtermodels.cpp') diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp index 1d6830ee0..ce0c2528c 100644 --- a/qt-models/filtermodels.cpp +++ b/qt-models/filtermodels.cpp @@ -592,7 +592,7 @@ bool MultiFilterSortModel::showDive(const struct dive *d) const dive_site *ds = d->dive_site; if (!ds) return false; - return same_string(ds->name, curr_dive_site->name) || ds->uuid == curr_dive_site->uuid; + return ds == curr_dive_site || same_string(ds->name, curr_dive_site->name); } if (models.isEmpty()) -- cgit v1.2.3-70-g09d2