summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mate-session/gsm-xsmp-client.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/mate-session/gsm-xsmp-client.c b/mate-session/gsm-xsmp-client.c
index f8b78c2..759e2ab 100644
--- a/mate-session/gsm-xsmp-client.c
+++ b/mate-session/gsm-xsmp-client.c
@@ -524,6 +524,11 @@ get_desktop_file_path (GsmXSMPClient *client)
/* If we can't get desktop file from GsmDesktopFile then we
* try to find the desktop file from its program name */
prop = find_property (client, SmProgram, NULL);
+
+ if (!prop) {
+ goto out;
+ }
+
program_name = prop->vals[0].value;
dirs = gsm_util_get_autostart_dirs ();
@@ -551,7 +556,16 @@ set_desktop_file_keys_from_client (GsmClient *client,
char *comment;
prop = find_property (GSM_XSMP_CLIENT (client), SmProgram, NULL);
- name = g_strdup (prop->vals[0].value);
+
+ if (prop) {
+ name = g_strdup (prop->vals[0].value);
+ } else {
+ /* It'd be really surprising to reach this code: if we're here,
+ * then the XSMP client already has set several XSMP
+ * properties. But it could still be that SmProgram is not set.
+ */
+ name = g_strdup (_("Remembered Application"));
+ }
comment = g_strdup_printf ("Client %s which was automatically saved",
gsm_client_peek_startup_id (client));
@@ -639,6 +653,7 @@ xsmp_save (GsmClient *client,
desktop_file_path = get_desktop_file_path (GSM_XSMP_CLIENT (client));
+ /* this can accept desktop_file_path == NULL */
keyfile = create_client_key_file (client,
desktop_file_path,
&local_error);
@@ -778,10 +793,12 @@ static char *
xsmp_get_app_name (GsmClient *client)
{
SmProp *prop;
- char *name;
+ char *name = NULL;
prop = find_property (GSM_XSMP_CLIENT (client), SmProgram, NULL);
- name = prop_to_command (prop);
+ if (prop) {
+ name = prop_to_command (prop);
+ }
return name;
}