mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 14:31:09 +08: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:
parent
11df0bf54b
commit
141dcde498
@ -323,7 +323,7 @@ impl From<Signal> for i32 {
|
||||
|
||||
impl From<Signal> for usize {
|
||||
fn from(value: Signal) -> Self {
|
||||
value.code() as usize
|
||||
usize::try_from(value.code()).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user