Skip to content

Commit

Permalink
fix: crashing when viewing armor item with undefined resitances (#4303)
Browse files Browse the repository at this point in the history
* fix: fix crashing when viewing armor item with undefined resitances

* style(autofix.ci): automated formatting

* typo fix

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
LordZanos and autofix-ci[bot] authored Mar 5, 2024
1 parent 5f11abf commit 2b27074
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6170,7 +6170,7 @@ int item::acid_resist( bool to_self, int base_env_resist ) const
float mod = get_clothing_mod_val( clothing_mod_type_acid );

std::optional<resistances> overriden_resistance = damage_resistance_override();
if( overriden_resistance->flat.count( DT_ACID ) ) {
if( overriden_resistance && overriden_resistance->flat.count( DT_ACID ) ) {
return std::lround( overriden_resistance->flat[DT_ACID] + mod );
}

Expand Down Expand Up @@ -6209,7 +6209,7 @@ int item::fire_resist( bool to_self, int base_env_resist ) const
float mod = get_clothing_mod_val( clothing_mod_type_fire );

std::optional<resistances> overriden_resistance = damage_resistance_override();
if( overriden_resistance->flat.count( DT_HEAT ) ) {
if( overriden_resistance && overriden_resistance->flat.count( DT_HEAT ) ) {
return std::lround( overriden_resistance->flat[DT_HEAT] + mod );
}

Expand Down

0 comments on commit 2b27074

Please sign in to comment.