Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: InputSystem#getInputsForBindButton was throwing NPE #4256

Merged
merged 2 commits into from Nov 21, 2020

Conversation

skaldarnar
Copy link
Member

I think the only usage of that API wrapper method (in Omega) is in Dialogs where it is used to get the associated bind for an action to display it as a hint to the user.

https://github.com/Terasology/Dialogs/blob/5a0073966afc66f18bc1d7220c7b49c8c053d9c2/src/main/java/org/terasology/dialogs/DialogSystem.java#L190

This was throwing a NPE for a while, resulting in the hint not showing up. This PR fixes that.

@skaldarnar skaldarnar added the Type: Bug Issues reporting and PRs fixing problems label Nov 20, 2020
*
* @param bindId the ID.
* @return a list of keyboard/mouse inputs that trigger the binding.
*/
public List<Input> getInputsForBindButton(SimpleUri bindId) {
return bindsSubsystem.getInputsForBindButton(bindId);
return bindsManager.getBindsConfig().getBinds(bindId);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual bug fix, all other changes are just IntelliJ's formatting...

@@ -78,9 +77,6 @@
@In
private CameraTargetSystem targetSystem;

@In
private BindsSubsystem bindsSubsystem;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bindsSubsystem was null here anyways, and the only place this was used could easily be replaced with access to the super interface of BindsManager.

@jdrueckert jdrueckert merged commit a45d3c2 into develop Nov 21, 2020
@jdrueckert jdrueckert deleted the fix/input-system branch November 21, 2020 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues reporting and PRs fixing problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants