diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2006-04-20 04:34:18 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2006-04-20 04:34:18 +0000 |
| commit | 0b98e816d858a5bc49b0596293760c5237f58e8d (patch) | |
| tree | 8ffca9ff2b6de8bc6308444efaf2e910e1406c3a /src | |
| parent | a82e7879ceb7eb6e261ca46b0d797d7808a8afce (diff) | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Preferences.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
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); |
