mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-29 18:51:15 -03:00
signal.rs: crash a bit earlier when signal number is negative
The conversion to usize is used for array accesses, so negative values would cause crashes either way. Let's do it earlier so we can get rid of the suspect C-style cast.
This commit is contained in:
@@ -323,7 +323,7 @@ fn from(value: Signal) -> Self {
|
||||
|
||||
impl From<Signal> for usize {
|
||||
fn from(value: Signal) -> Self {
|
||||
value.code() as usize
|
||||
usize::try_from(value.code()).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user