mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
remove unwrap from controller modifier handler
This commit is contained in:
parent
b9c33df635
commit
3f6d23ad7f
@ -602,8 +602,14 @@ impl Window {
|
||||
if settings.modifier_buttons.contains(button) {
|
||||
if is_pressed {
|
||||
modifiers.push(*button);
|
||||
} else {
|
||||
let index = modifiers.iter().position(|x| x == button).unwrap();
|
||||
// There is a possibility of voxygen not having
|
||||
// registered the initial press event (either because it
|
||||
// hadn't started yet, or whatever else) hence the
|
||||
// modifier has no position in the list, unwrapping
|
||||
// here would cause a crash in those cases
|
||||
} else if let Some(index) =
|
||||
modifiers.iter().position(|modifier| modifier == button)
|
||||
{
|
||||
modifiers.remove(index);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user