diff --git a/libfprint/fp-context.c b/libfprint/fp-context.c index e70077f..6971763 100644 --- a/libfprint/fp-context.c +++ b/libfprint/fp-context.c @@ -210,7 +210,8 @@ fp_context_finalize (GObject *object) g_clear_object (&priv->cancellable); g_clear_pointer (&priv->drivers, g_array_unref); - g_object_run_dispose (G_OBJECT (priv->usb_ctx)); + if (priv->usb_ctx) + g_object_run_dispose (G_OBJECT (priv->usb_ctx)); g_clear_object (&priv->usb_ctx); G_OBJECT_CLASS (fp_context_parent_class)->finalize (object); @@ -342,7 +343,8 @@ fp_context_enumerate (FpContext *context) priv->enumerated = TRUE; /* USB devices are handled from callbacks */ - g_usb_context_enumerate (priv->usb_ctx); + if (priv->usb_ctx) + g_usb_context_enumerate (priv->usb_ctx); /* Handle Virtual devices based on environment variables */ for (i = 0; i < priv->drivers->len; i++)