From: Linus Torvalds <[email protected]> Date: Tue, 21 Oct 2014 08:45:09 -0700 Subject: [PATCH] Fix dc nickname helper function
This helper function is used to get a nickname for a dive computer, when the model information on its own may be ambiguous (ie there may be multiple dive computers of the same model, and we've nicknamed them by owner). However, the helper did completely the wrong thing if it didn't find a dive computer entry at all due to a missing device ID - it would just return empty. Which is bogus: it should return the model name, the same way it does if the nickname is missing. Signed-off-by: Linus Torvalds <[email protected]> --- I'm finding these small oddities because I have an incomplete libdivecomputer backend for my Suunto EON Steel, and it doesn't give a device ID yet. But subsurface shouldn't display an empty model name just because there isn't a device ID. qt-gui.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/qt-gui.cpp b/qt-gui.cpp index 54ed76317e5f..94945cdbf16b 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -200,9 +200,8 @@ void set_filename(const char *filename, bool force) const QString get_dc_nickname(const char *model, uint32_t deviceid) { const DiveComputerNode *existNode = dcList.getExact(model, deviceid); - if (!existNode) - return QString(); - else if (!existNode->nickName.isEmpty()) + + if (existNode && !existNode->nickName.isEmpty()) return existNode->nickName; else return model; -- 2.1.2.452.gd5ca7ae _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
