Skip to content

Commit

Permalink
fixed null pointer crash caused by incorrect handling of gamepad index
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Jan 17, 2024
1 parent 9df8a71 commit b9743bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/stream/input/session_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ void session_input_interrupt(stream_input_t *input) {

void session_input_started(stream_input_t *input) {
input->started = true;
for (int i = 0, j = app_input_get_gamepads_count(input->input); i < j; ++i) {
stream_input_send_gamepad_arrive(input, app_input_gamepad_state_by_index(input->input, i));
for (int i = 0, j = app_input_get_max_gamepads(input->input); i < j; ++i) {
app_gamepad_state_t *gamepad = app_input_gamepad_state_by_index(input->input, i);
if (gamepad == NULL) {
continue;
}
stream_input_send_gamepad_arrive(input, gamepad);
}
}

Expand Down

0 comments on commit b9743bb

Please sign in to comment.