only push audio event if payload size > 0

This commit is contained in:
itsmattkc 2024-11-04 20:29:10 -08:00
parent af454b07e1
commit 5c42244a4c

View file

@ -59,7 +59,9 @@ void handle_audio_packet(gamepad_context_t *ctx, char *data, size_t len)
return;
}
push_event(ctx->event_loop, VANILLA_EVENT_AUDIO, ap->payload, ap->payload_size);
if (ap->payload_size) {
push_event(ctx->event_loop, VANILLA_EVENT_AUDIO, ap->payload, ap->payload_size);
}
uint8_t vibrate_val = ap->vibrate;
push_event(ctx->event_loop, VANILLA_EVENT_VIBRATE, &vibrate_val, sizeof(vibrate_val));