diff --git a/src/fruity/device-monitor.vala b/src/fruity/device-monitor.vala index d5a8ed32c..8b0310eb5 100644 --- a/src/fruity/device-monitor.vala +++ b/src/fruity/device-monitor.vala @@ -745,7 +745,8 @@ namespace Frida.Fruity { io_cancellable.cancel (); - usb_context.interrupt_event_handler (); + if (usb_context != null) + usb_context.interrupt_event_handler (); usb_worker.join (); usb_worker = null; @@ -787,7 +788,8 @@ namespace Frida.Fruity { } private void perform_usb_work () { - LibUSB.Context.init (out usb_context); + if (LibUSB.Context.init (out usb_context) != SUCCESS) + return; AtomicUint.inc (ref pending_device_arrivals);