From 0b98e816d858a5bc49b0596293760c5237f58e8d Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 20 Apr 2006 04:34:18 +0000 Subject: Fixed crash in Fl_Preferences if 2nd or 3rd argument in the 'path' constructor were NULL git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5007 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Preferences.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx index 98321d28a..dd3ee828e 100644 --- a/src/Fl_Preferences.cxx +++ b/src/Fl_Preferences.cxx @@ -693,12 +693,17 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char // - construct the name of the file that will hold our preferences Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, const char *path, const char *vendor, const char *application ) { - char filename[ FL_PATH_MAX ]; filename[0] = 0; - - snprintf(filename, sizeof(filename), "%s/%s.prefs", path, application); - + if (!vendor) + vendor = "unknown"; + if (!application) { + application = "unknown"; + filename_ = strdup(path); + } else { + char filename[ FL_PATH_MAX ]; filename[0] = 0; + snprintf(filename, sizeof(filename), "%s/%s.prefs", path, application); + filename_ = strdup(filename); + } prefs_ = prefs; - filename_ = strdup(filename); vendor_ = strdup(vendor); application_ = strdup(application); -- cgit v1.2.3