utils/flexver: handle i64 overflow gracefully

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I66386d97f92744a5c07c04b072bc1a626a6a6964
This commit is contained in:
raf 2026-04-18 21:52:57 +03:00
commit a8bf8f9f3f
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF

View file

@ -79,10 +79,12 @@ fn decompose(str_in: &str) -> VecDeque<SortingType> {
if numeric {
return None;
} else {
return Some(Numerical(
current.parse::<i64>().unwrap(),
current.to_owned(),
));
return Some(
current
.parse::<i64>()
.map(|n| Numerical(n, current.to_owned()))
.unwrap_or_else(|_| Lexical(current.to_owned())),
);
}
}