goodixmoc: fix crash in exit callback handler

If the button shield command cannot be executed due to an underlying
error then resp is NULL. Avoid the crash by adding the appropriate
check.

Closes: #694
This commit is contained in:
Benjamin Berg
2025-07-24 08:39:54 +02:00
parent d83a785260
commit da42268911

View File

@@ -1483,9 +1483,7 @@ gx_fp_exit_cb (FpiDeviceGoodixMoc *self,
gxfp_cmd_response_t *resp, gxfp_cmd_response_t *resp,
GError *error) GError *error)
{ {
if (resp && resp->result >= GX_FAILED)
if (resp->result >= GX_FAILED)
fp_dbg ("Setting power button shield failed, result: 0x%x", resp->result); fp_dbg ("Setting power button shield failed, result: 0x%x", resp->result);
self->is_power_button_shield_on = false; self->is_power_button_shield_on = false;
gx_fp_release_interface (self, error); gx_fp_release_interface (self, error);