[PATCH 1/2] Update preference saving for numeric values

Linus Torvalds torvalds at linux-foundation.org
Fri Jan 11 11:58:34 PST 2013

From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Fri, 11 Jan 2013 11:37:32 -0800
Subject: [PATCH 2/2] Fix SIGSEGV if no pre-existing nickname information

Loading an xml file with dive computer information without any
preexisting nickname data would try to "remember" that NULL nickname.
Causing a SIGSEGV if there was no nickname information.

The bug was introduced by commit ec38d3708df2 ("Move device_info handling 
into a new 'device.c' file") when I inadvertently removed a bit too much 
code. It actually wants to remember a missing DC nickname as an empty one.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>

 gtk-gui.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gtk-gui.c b/gtk-gui.c
index 60dde03990a5..d096e7e90ccf 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -1737,6 +1737,9 @@ void remember_dc(const char *model, uint32_t deviceid, const char *nickname, gbo
 	if (!nn_entry)
+	if (!nickname)
+		nickname = "";
 	/* No existing nickname? */
 	if (!nn_entry->nickname) {
 		char buffer[160];

More information about the subsurface mailing list