1
0
Fork 0

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:
Jason Gerecke 2024-10-04 10:19:35 -07:00 committed by Marge Bot
parent d46352b23f
commit d7d92c68bd

View file

@ -737,6 +737,10 @@ pad_switch_mode (ClutterInputDevice *device,
wacom_device =
meta_input_device_get_wacom_device (META_INPUT_DEVICE (device));
if (!wacom_device)
return FALSE;
n_buttons = libwacom_get_num_buttons (wacom_device);
for (i = 0; i < n_buttons; i++)