diff --git a/src/driver-hidpp10.c b/src/driver-hidpp10.c index 7fc05b03..eaa83d19 100644 --- a/src/driver-hidpp10.c +++ b/src/driver-hidpp10.c @@ -752,14 +752,14 @@ static void hidpp10drv_remove(struct ratbag_device *device) { struct hidpp10drv_data *drv_data; - struct hidpp10_device *dev; ratbag_close_hidraw(device); drv_data = ratbag_get_drv_data(device); - dev = drv_data->dev; + if (!drv_data) + return; - hidpp10_device_destroy(dev); + hidpp10_device_destroy(drv_data->dev); free(drv_data); }