Skip to content

Commit

Permalink
fix: crash if capacitor-peak-delta attribute value is absent
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueBrain committed Jul 18, 2024
1 parent c6cc950 commit b9fdc76
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/calculate/pass_4/capacitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ struct Module {
pub fn attribute_capacitor_depletes_in(ship: &mut Ship) {
/* Amount of seconds it takes for the capacitor to deplete; or negative if it is stable. */

if !ship
.hull
.attributes
.contains_key(&(AttributeId::capacitorDepletesIn as i32))
{
return;
}

let mut depletes_in = -1.0;

let attr_capacitor_peak_delta = ship
Expand Down

0 comments on commit b9fdc76

Please sign in to comment.