backends/x11: Avoid potential crash in pad_switch_mode
The meta_input_device_get_wacom_device function may return NULL, so we should check it before use. I'm not 100% sure that the code as currently written could reach here with a NULL wacom_device, but that could change in the future. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4070>
This commit is contained in:
parent
d46352b23f
commit
d7d92c68bd
1 changed files with 4 additions and 0 deletions
|
@ -737,6 +737,10 @@ pad_switch_mode (ClutterInputDevice *device,
|
||||||
|
|
||||||
wacom_device =
|
wacom_device =
|
||||||
meta_input_device_get_wacom_device (META_INPUT_DEVICE (device));
|
meta_input_device_get_wacom_device (META_INPUT_DEVICE (device));
|
||||||
|
|
||||||
|
if (!wacom_device)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
n_buttons = libwacom_get_num_buttons (wacom_device);
|
n_buttons = libwacom_get_num_buttons (wacom_device);
|
||||||
|
|
||||||
for (i = 0; i < n_buttons; i++)
|
for (i = 0; i < n_buttons; i++)
|
||||||
|
|
Loading…
Reference in a new issue