[empathy] deal if ag_manager_new_for_service_type() returns NULL
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] deal if ag_manager_new_for_service_type() returns NULL
- Date: Mon, 8 Oct 2012 08:56:55 +0000 (UTC)
commit 63c548da561529db7d69251ff8ba089d0b73938a
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Fri Oct 5 13:28:04 2012 +0200
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
.../mc-plugin/mcp-account-manager-uoa.c | 19 +++++++++++++++++++
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 0e1705b..c46a5f8 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]