diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-10-24 14:43:32 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-10-25 13:58:03 -0700 |
commit | e30ba8a8e0f1c182ae3ce7022667b7aca17d3df4 (patch) | |
tree | b9fde8518e27bcf93aef67da364246a3bbfcf2b8 /qt-models/divetripmodel.cpp | |
parent | 272b7b3e278b291e2df0f7bf290856f1daa950bc (diff) | |
download | subsurface-e30ba8a8e0f1c182ae3ce7022667b7aca17d3df4.tar.gz |
cleanup: fix over-eager Coverity warnings
Technically get_dive(i) could return a nullptr. But given the range for i that
can never happen. Still, the test is extremely cheap and doesn't hurt.
Fixes CID 354768
Fixes CID 354766
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models/divetripmodel.cpp')
-rw-r--r-- | qt-models/divetripmodel.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index bc2c2ea46..6b700a92e 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -716,6 +716,8 @@ void DiveTripModelTree::populate() uiNotification(QObject::tr("start processing")); for (int i = 0; i < dive_table.nr; ++i) { dive *d = get_dive(i); + if (!d) // should never happen + continue; update_cylinder_related_info(d); if (d->hidden_by_filter) continue; @@ -1482,7 +1484,7 @@ void DiveTripModelList::populate() items.reserve(dive_table.nr); for (int i = 0; i < dive_table.nr; ++i) { dive *d = get_dive(i); - if (d->hidden_by_filter) + if (!d || d->hidden_by_filter) continue; items.push_back(d); } |