1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Fixed GLib assertion error when no XDG env set

This commit is contained in:
James Booth 2012-11-26 10:43:19 +00:00
parent 56e5d16938
commit 0e178ab411

View File

@ -29,7 +29,8 @@ gchar *
xdg_get_config_home(void) xdg_get_config_home(void)
{ {
gchar *xdg_config_home = getenv("XDG_CONFIG_HOME"); gchar *xdg_config_home = getenv("XDG_CONFIG_HOME");
g_strstrip(xdg_config_home); if (xdg_config_home != NULL)
g_strstrip(xdg_config_home);
if ((xdg_config_home != NULL) && (strcmp(xdg_config_home, "") != 0)) { if ((xdg_config_home != NULL) && (strcmp(xdg_config_home, "") != 0)) {
return strdup(xdg_config_home); return strdup(xdg_config_home);
@ -47,7 +48,8 @@ gchar *
xdg_get_data_home(void) xdg_get_data_home(void)
{ {
gchar *xdg_data_home = getenv("XDG_DATA_HOME"); gchar *xdg_data_home = getenv("XDG_DATA_HOME");
g_strstrip(xdg_data_home); if (xdg_data_home != NULL)
g_strstrip(xdg_data_home);
if ((xdg_data_home != NULL) && (strcmp(xdg_data_home, "") != 0)) { if ((xdg_data_home != NULL) && (strcmp(xdg_data_home, "") != 0)) {
return strdup(xdg_data_home); return strdup(xdg_data_home);