From 92202b819168ac29193936540bf47137185052dc Mon Sep 17 00:00:00 2001 From: Danielle Madeley Date: Thu, 21 Oct 2010 13:20:58 +1100 Subject: Don't assume account will exist when accessing storage restrictions Fixes https://bugzilla.gnome.org/show_bug.cgi?id=632681 --- libempathy-gtk/empathy-account-widget.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 0bb918e1a..8a3981486 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -1922,6 +1922,7 @@ do_constructed (GObject *obj) EmpathyAccountWidget *self = EMPATHY_ACCOUNT_WIDGET (obj); EmpathyAccountWidgetPriv *priv = GET_PRIV (self); TpAccount *account; + TpStorageRestrictionFlags storage_restrictions; const gchar *display_name, *default_display_name; guint i = 0; struct { @@ -1944,9 +1945,13 @@ do_constructed (GObject *obj) account = empathy_account_settings_get_account (priv->settings); + if (account != NULL) + storage_restrictions = tp_account_get_storage_restrictions (account); + else + storage_restrictions = 0; + /* Empathy can only edit accounts without the Cannot_Set_Parameters flag */ - if (tp_account_get_storage_restrictions (account) & - TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PARAMETERS) + if (storage_restrictions & TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PARAMETERS) { DEBUG ("Account is provided by an external storage provider"); @@ -2005,7 +2010,7 @@ do_constructed (GObject *obj) /* handle apply and cancel button */ if (!priv->simple && - !(tp_account_get_storage_restrictions (account) & + !(storage_restrictions & TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PARAMETERS)) { GtkWidget *hbox = gtk_hbox_new (TRUE, 3); @@ -2066,8 +2071,7 @@ do_constructed (GObject *obj) #endif /* HAVE_MEEGO */ /* add the Enable checkbox to accounts that support it */ - if (!(tp_account_get_storage_restrictions (account) & - TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_ENABLED)) + if (!(storage_restrictions & TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_ENABLED)) add_enable_checkbox (self, account); /* hook up to widget destruction to unref ourselves */ -- cgit v1.2.3