context: Fix invalid accesses to GUsbContext if USB is missing
When USB cannot be initialised (inside the flatpak build environment), then we would have invalid accesses to the NULL pointer. Fix those.
This commit is contained in:
parent
c85f385191
commit
596d22a449
1 changed files with 4 additions and 2 deletions
|
@ -210,6 +210,7 @@ fp_context_finalize (GObject *object)
|
||||||
g_clear_object (&priv->cancellable);
|
g_clear_object (&priv->cancellable);
|
||||||
g_clear_pointer (&priv->drivers, g_array_unref);
|
g_clear_pointer (&priv->drivers, g_array_unref);
|
||||||
|
|
||||||
|
if (priv->usb_ctx)
|
||||||
g_object_run_dispose (G_OBJECT (priv->usb_ctx));
|
g_object_run_dispose (G_OBJECT (priv->usb_ctx));
|
||||||
g_clear_object (&priv->usb_ctx);
|
g_clear_object (&priv->usb_ctx);
|
||||||
|
|
||||||
|
@ -342,6 +343,7 @@ fp_context_enumerate (FpContext *context)
|
||||||
priv->enumerated = TRUE;
|
priv->enumerated = TRUE;
|
||||||
|
|
||||||
/* USB devices are handled from callbacks */
|
/* USB devices are handled from callbacks */
|
||||||
|
if (priv->usb_ctx)
|
||||||
g_usb_context_enumerate (priv->usb_ctx);
|
g_usb_context_enumerate (priv->usb_ctx);
|
||||||
|
|
||||||
/* Handle Virtual devices based on environment variables */
|
/* Handle Virtual devices based on environment variables */
|
||||||
|
|
Loading…
Reference in a new issue