1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 18:54:05 +02:00

Merge pull request #4 from MinusGix/fix-validate-indexes

allow empty indexes
This commit is contained in:
Robin Appelman 2023-11-11 21:30:18 +01:00 committed by GitHub
commit 7331df6ad5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -513,7 +513,10 @@ impl Bsp {
source: &'static str,
target: &'static str,
) -> BspResult<()> {
let max = indexes.max().unwrap_or_default();
let max = match indexes.max() {
Some(max) => max,
None => return Ok(()),
};
max.try_into()
.ok()
.and_then(|index| list.get(index))