From 130946fcf45375283661547502c389390bc2d443 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 27 Oct 2019 07:36:35 -0400 Subject: [PATCH] Cleanup: NULL check pointer before dereferencing I we have no dive, whatever this is shouldn't be shown. Found by Coverity. Fixes CID 350093 Signed-off-by: Dirk Hohndel --- qt-models/filtermodels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp index 22a0d19cb..0226e1220 100644 --- a/qt-models/filtermodels.cpp +++ b/qt-models/filtermodels.cpp @@ -250,7 +250,7 @@ void MultiFilterSortModel::myInvalidate() m->setData(idx, showTrip, DiveTripModelBase::SHOWN_ROLE); } else { dive *d = m->data(idx, DiveTripModelBase::DIVE_ROLE).value(); - bool show = showDive(d); + bool show = (d != NULL) && showDive(d); if (show) divesDisplayed++; m->setData(idx, show, DiveTripModelBase::SHOWN_ROLE);