mirror of https://github.com/bsnes-emu/bsnes.git
settings/input: Fix updateControls crashes
updateControls assumes that when activeMapping is set, an item from mappingList is guaranteed to be selected. However, there are several scenarios that break this assumption: - changing port during an active mapping - changing device during an active mapping - reloading the input driver during an active mapping In all of these cases, updateControls is eventually called. It sees an outstanding activeMapping and proceeds to figure out the offset of the currently selected item, but since there are no selected items it ends up dereferncing a null pointer. The assumption can be honored by having reloadMappings cancel the outstanding activeMapping, thus preventing a crash. Fixes #4.
This commit is contained in:
parent
69d527f322
commit
97452b6ec3
|
@ -124,7 +124,7 @@ auto InputSettings::reloadMappings() -> void {
|
||||||
for(uint n : range(BindingLimit)) item.append(TableViewCell());
|
for(uint n : range(BindingLimit)) item.append(TableViewCell());
|
||||||
}
|
}
|
||||||
refreshMappings();
|
refreshMappings();
|
||||||
updateControls();
|
cancelMapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto InputSettings::refreshMappings() -> void {
|
auto InputSettings::refreshMappings() -> void {
|
||||||
|
|
Loading…
Reference in New Issue