summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2025-03-07 15:08:06 +0100
committerMatthias Melcher <github@matthiasm.com>2025-03-07 15:08:06 +0100
commitdaf20b86af28bc7db061135fa2bd14e97fef9f20 (patch)
treec161965be9989786e26b85cf478fcaf1d1a82f6d /src/drivers
parent7f60f019d77697c5e4e3a46f9571e1a25328b4b3 (diff)
Fixing error where std::string could be assigned NULL'
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Unix/Fl_Unix_System_Driver.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/drivers/Unix/Fl_Unix_System_Driver.cxx b/src/drivers/Unix/Fl_Unix_System_Driver.cxx
index 3671aabd7..f1d846842 100644
--- a/src/drivers/Unix/Fl_Unix_System_Driver.cxx
+++ b/src/drivers/Unix/Fl_Unix_System_Driver.cxx
@@ -538,7 +538,8 @@ char *Fl_Unix_System_Driver::preference_user_rootnode(
char *buffer)
{
// Find the path to the user's home directory.
- std::string home_path = getenv("HOME");
+ const char *home_path_c = getenv("HOME");
+ std::string home_path = home_path_c ? home_path_c : "";
if (home_path.empty()) {
struct passwd *pw = getpwuid(getuid());
if (pw)
@@ -546,7 +547,8 @@ char *Fl_Unix_System_Driver::preference_user_rootnode(
}
// 1: Generate the 1.4 path for this vendor and application.
- std::string prefs_path_14 = getenv("XDG_CONFIG_HOME");
+ const char *prefs_path_14_c = getenv("XDG_CONFIG_HOME");
+ std::string prefs_path_14 = prefs_path_14_c ? prefs_path_14_c : "";
if (prefs_path_14.empty()) {
prefs_path_14 = home_path + "/.config";
} else {