summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-01-19 11:47:36 +0100
committerMatthias Melcher <github@matthiasm.com>2024-01-19 11:47:41 +0100
commited757454ebc63ad112d29a3b432f8dda4b67dfdd (patch)
tree43126dff83d6a2ec671ee17f89521f7d4d08bc08
parent13d412f82f12d42e3add52c9ba0dd62c7cf68ed2 (diff)
Fix crash in Fl_Preferences for deformed group name (#891)
-rw-r--r--src/Fl_Preferences.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx
index bce0471f8..cc3538a78 100644
--- a/src/Fl_Preferences.cxx
+++ b/src/Fl_Preferences.cxx
@@ -2,7 +2,7 @@
// Preferences methods for the Fast Light Tool Kit (FLTK).
//
// Copyright 2002-2010 by Matthias Melcher.
-// Copyright 2011-2023 by Bill Spitzak and others.
+// Copyright 2011-2024 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -1324,13 +1324,13 @@ int Fl_Preferences::RootNode::read() {
size_t end = strcspn( buf+1, "\n\r" );
if ( end != 0 ) { // if entry is not empty
buf[ end+1 ] = 0;
- nd->add( buf+1 );
+ if (nd) nd->add( buf+1 );
}
} else { // read a name/value pair
size_t end = strcspn( buf, "\n\r" );
if ( end != 0 ) { // if entry is not empty
buf[ end ] = 0;
- nd->set( buf );
+ if (nd) nd->set( buf );
}
}
}