mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 00:47:30 +00: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
1 changed files with 1 additions and 1 deletions
|
@ -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…
Reference in a new issue