mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'crabman/controller-modifier-unwrap' into 'master'
Get rid of unwrap in controller modifier handler See merge request veloren/veloren!4115
This commit is contained in:
commit
256b3d1e16
@ -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