aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-10-05 19:28:04 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-10-08 16:49:26 +0800
commit63c548da561529db7d69251ff8ba089d0b73938a (patch)
treea9c680bf84b09c8ea538a77724d2c50c420dc6f3
parent537ac5a986ea5b3959ae42f5b87145451a81b9b3 (diff)
downloadgsoc2013-empathy-63c548da561529db7d69251ff8ba089d0b73938a.tar
gsoc2013-empathy-63c548da561529db7d69251ff8ba089d0b73938a.tar.gz
gsoc2013-empathy-63c548da561529db7d69251ff8ba089d0b73938a.tar.bz2
gsoc2013-empathy-63c548da561529db7d69251ff8ba089d0b73938a.tar.lz
gsoc2013-empathy-63c548da561529db7d69251ff8ba089d0b73938a.tar.xz
gsoc2013-empathy-63c548da561529db7d69251ff8ba089d0b73938a.tar.zst
gsoc2013-empathy-63c548da561529db7d69251ff8ba089d0b73938a.zip
deal if ag_manager_new_for_service_type() returns NULL
Looks like it may happen because of Ubuntu's apparmor policy. We can't do much in this case but best to not crash MC at least. https://bugzilla.gnome.org/show_bug.cgi?id=685498
-rw-r--r--ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c b/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c
index 0e1705bda..c46a5f89f 100644
--- a/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c
+++ b/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c
@@ -354,6 +354,7 @@ mcp_account_manager_uoa_init (McpAccountManagerUoa *self)
self->priv->pending_signals = g_queue_new ();
self->priv->manager = ag_manager_new_for_service_type (SERVICE_TYPE);
+ g_return_if_fail (self->priv->manager != NULL);
g_signal_connect (self->priv->manager, "account-created",
G_CALLBACK (_account_created_cb), self);
@@ -428,6 +429,8 @@ account_manager_uoa_list (const McpAccountStorage *storage,
DEBUG (G_STRFUNC);
+ g_return_val_if_fail (self->priv->manager != NULL, NULL);
+
_ensure_loaded (self);
g_hash_table_iter_init (&iter, self->priv->accounts);
@@ -460,6 +463,8 @@ account_manager_uoa_get (const McpAccountStorage *storage,
AgService *s;
gboolean handled = FALSE;
+ g_return_if_fail (self->priv->manager != NULL);
+
service = g_hash_table_lookup (self->priv->accounts, account_name);
if (service == NULL)
return FALSE;
@@ -539,6 +544,8 @@ account_manager_uoa_set (const McpAccountStorage *storage,
AgAccountService *service;
AgAccount *account;
+ g_return_if_fail (self->priv->manager != NULL);
+
service = g_hash_table_lookup (self->priv->accounts, account_name);
if (service == NULL)
return FALSE;
@@ -580,6 +587,8 @@ account_manager_uoa_create (const McpAccountStorage *storage,
AgAccountService *service;
GList *l;
+ g_return_if_fail (self->priv->manager != NULL);
+
if (!self->priv->ready)
{
g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
@@ -626,6 +635,8 @@ account_manager_uoa_delete (const McpAccountStorage *storage,
AgAccountService *service;
AgAccount *account;
+ g_return_if_fail (self->priv->manager != NULL);
+
service = g_hash_table_lookup (self->priv->accounts, account_name);
if (service == NULL)
return FALSE;
@@ -657,6 +668,8 @@ account_manager_uoa_commit (const McpAccountStorage *storage,
DEBUG (G_STRFUNC);
+ g_return_if_fail (self->priv->manager != NULL);
+
g_hash_table_iter_init (&iter, self->priv->accounts);
while (g_hash_table_iter_next (&iter, NULL, &value))
{
@@ -706,6 +719,8 @@ account_manager_uoa_ready (const McpAccountStorage *storage,
McpAccountManagerUoa *self = (McpAccountManagerUoa *) storage;
DelayedSignalData *data;
+ g_return_if_fail (self->priv->manager != NULL);
+
if (self->priv->ready)
return;
@@ -747,6 +762,8 @@ account_manager_uoa_get_identifier (const McpAccountStorage *storage,
AgAccountService *service;
AgAccount *account;
+ g_return_if_fail (self->priv->manager != NULL);
+
service = g_hash_table_lookup (self->priv->accounts, account_name);
if (service == NULL)
return;
@@ -766,6 +783,8 @@ account_manager_uoa_get_restrictions (const McpAccountStorage *storage,
guint restrictions = TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_SERVICE;
GValue value = G_VALUE_INIT;
+ g_return_val_if_fail (self->priv->manager != NULL, 0);
+
/* If we don't know this account, we cannot do anything */
service = g_hash_table_lookup (self->priv->accounts, account_name);
if (service == NULL)