Skip to content

Gamepad RemoveListeners crashes when leaving a Scene #7186

@adamosimpson21

Description

@adamosimpson21

Version

  • Phaser Version: 3.90.0
  • Operating system: Windows
  • Browser: no

Description

When using a gamepad and leaving a scene, I get the error cannot removeAllListeners() from undefined. I believe this is caused by the code in [
phaser/src/input/gamepad/GamepadPlugin.js LN 294 - 308 not checking for null while doing the loop. Since some of the gamepads return null in the array, the game crashes. I believe this is only for some machines with gamepads that are null, but my machine is one of them.

Example Test Code

Additional Information

I have fixed it locally, so I will open a PR for my fix shortly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions