From 6a07ccbad273cdcbea3f984c5c2e9d1b272aae05 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 7 Jan 2018 15:42:28 +0100 Subject: Use helper function empty_string() instead of manual checks For code consistency, substitute boolean expressions: s && *s -> !empty_string(s) s && s[0] -> !empty_string(s) !s || !*s -> empty_string(s) !s || !s[0] -> empty_string(s) Signed-off-by: Berthold Stoeger --- qt-models/divetripmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qt-models/divetripmodel.cpp') diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index b2ca11844..63e5f6afd 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -70,7 +70,7 @@ QVariant TripItem::data(int column, int role) const } if (countShown < trip->nrdives) shownText = tr("(%1 shown)").arg(countShown); - if (trip->location && *trip->location) + if (!empty_string(trip->location)) ret = QString(trip->location) + ", " + get_trip_date_string(trip->when, trip->nrdives, oneDayTrip) + " "+ shownText; else ret = get_trip_date_string(trip->when, trip->nrdives, oneDayTrip) + shownText; -- cgit v1.2.3-70-g09d2