Skip to content

Commit

Permalink
Fix index out of bounds panic with preserve-ids
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottyThePilot committed Jun 9, 2022
1 parent d06b358 commit fa86e16
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hoi4_province_editor"
version = "0.3.0"
version = "0.3.1"
authors = ["ScottyThePilot <scotty.codes@gmail.com>"]
edition = "2021"
description = "Map editor application for Hearts of Iron IV"
Expand Down
6 changes: 3 additions & 3 deletions src/app/map/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ fn deconstruct_map_data_preserve_ids(bundle: &Bundle) -> Result<MapData, Error>
if let Some(preserved_id) = province_data.preserved_id {
let definition = province_data.to_definition(color)?;
let index = (preserved_id - 1) as usize;
if index > count {
outlier_definitions.push(definition);
} else {
if index < sparse_definitions_table.len() {
sparse_definitions_table[index] = Some(definition);
} else {
outlier_definitions.push(definition);
};
} else {
outlier_definitions.push(province_data.to_definition_with_id(color, 0)?);
Expand Down

0 comments on commit fa86e16

Please sign in to comment.