From 47b932e44eed36e906bb89cb6a7c36d478718d50 Mon Sep 17 00:00:00 2001 From: Tim Allen Date: Thu, 5 Nov 2020 23:51:24 +1100 Subject: [PATCH] target-bsnes: Fix crash when clicking in an empty row while assiging inputs. When assigning an input, you can click on a different row of the bindings table to change which input you're assigning. As well as listening for keyboard and controller input, bsnes displays buttons to map the mouse axes or mouse buttons, depending on whether the new row you've selected represents an analog or digital input. However, some controllers do not have enough inputs to fill the default size of the input table. If you click below the last row, then *no* input is selected, and when bsnes tries to find the input associated with that not-a-row, it crashes. The solution is, only show the mouse axis/mouse button buttons when a valid row is selected. Mentioned in #75. --- bsnes/target-bsnes/settings/input.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsnes/target-bsnes/settings/input.cpp b/bsnes/target-bsnes/settings/input.cpp index 13b04b7a..99644f05 100644 --- a/bsnes/target-bsnes/settings/input.cpp +++ b/bsnes/target-bsnes/settings/input.cpp @@ -67,7 +67,7 @@ auto InputSettings::updateControls() -> void { assignMouse2.setVisible(false); assignMouse3.setVisible(false); - if(activeMapping) { + if(activeMapping && batched) { auto& input = activeDevice().mappings[batched.left().offset()]; if(input.isDigital()) { assignMouse1.setVisible().setText("Mouse Left");