summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2013-04-24 13:03:22 +0200
committerMarek Kasik <mkasik@redhat.com>2013-04-24 15:55:59 +0200
commit5a654556de7a85414e9ef3a465f383b9ea4357e7 (patch)
tree34331b40c72715e8d76cf59db02218dc4da691a5
parentf4c4e4c5e5f2bbcee5f83a83eb53f008368dc157 (diff)
downloadgnome-control-center-5a654556de7a85414e9ef3a465f383b9ea4357e7.tar.gz
printers: Don't crash without system-config-printer
Fix error handling in addition of new printer. https://bugzilla.gnome.org/show_bug.cgi?id=698642
-rw-r--r--panels/printers/pp-new-printer.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/panels/printers/pp-new-printer.c b/panels/printers/pp-new-printer.c
index 038a2ad2d..c76f1acfe 100644
--- a/panels/printers/pp-new-printer.c
+++ b/panels/printers/pp-new-printer.c
@@ -683,6 +683,7 @@ printer_add_async_scb (GObject *source_object,
GDBusConnection *bus;
GVariantBuilder array_builder;
GVariant *output;
+ gboolean cancelled = FALSE;
PPDName *ppd_item = NULL;
GError *error = NULL;
@@ -698,15 +699,15 @@ printer_add_async_scb (GObject *source_object,
}
else
{
- if (error->domain != G_IO_ERROR ||
- error->code != G_IO_ERROR_CANCELLED)
+ cancelled = g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
+
+ if (!cancelled)
g_warning ("%s", error->message);
- g_error_free (error);
+
+ g_clear_error (&error);
}
- if (!error ||
- error->domain != G_IO_ERROR ||
- error->code != G_IO_ERROR_CANCELLED)
+ if (!cancelled)
{
if (ppd_item == NULL || ppd_item->ppd_match_level < PPD_EXACT_MATCH)
{