From f10b66237e10f77d026335e9d39ad8a99a8f01bf Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 9 Jan 2015 14:55:21 -0800 Subject: If we can't find the dive, simply return no data This seems better than forcing a crash or accessing random data. Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'qt-ui/models.cpp') diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 0778b7bca..9246a0b07 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -1138,6 +1138,8 @@ QVariant DiveItem::data(int column, int role) const { QVariant retVal; struct dive *dive = get_dive_by_uniq_id(diveId); + if (!dive) + return QVariant(); switch (role) { case Qt::TextAlignmentRole: -- cgit v1.2.3-70-g09d2