[PATCH] Only add non-blank weights to the weight list

Tim Wootton tim at tee-jay.org.uk
Mon Jul 18 22:55:21 PDT 2016


Signed-off-by: Tim Wootton <tim at tee-jay.org.uk>
---
 core/subsurface-qt/DiveObjectHelper.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp
index e71b076..e5d9237 100644
--- a/core/subsurface-qt/DiveObjectHelper.cpp
+++ b/core/subsurface-qt/DiveObjectHelper.cpp
@@ -218,8 +218,12 @@ QString DiveObjectHelper::weightList() const
 QStringList DiveObjectHelper::weights() const
 {
 	QStringList weights;
-	for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++)
-		weights << getFormattedWeight(m_dive, i);
+	for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) {
+		QString w = getFormattedWeight(m_dive, i);
+		if (w == EMPTY_DIVE_STRING)
+			continue;
+		weights << w;
+	}
 	return weights;
 }
 
-- 
2.8.1



More information about the subsurface mailing list