Skip to content

Commit

Permalink
Fix deserialization of submap radiation: (#36903)
Browse files Browse the repository at this point in the history
Check bounds before setting the value.
  • Loading branch information
BevapDin authored and kevingranade committed Jan 10, 2020
1 parent 857e244 commit 06b4143
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/savegame_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3806,10 +3806,10 @@ void submap::load( JsonIn &jsin, const std::string &member_name, int version )
int rad_strength = jsin.get_int();
int rad_num = jsin.get_int();
for( int i = 0; i < rad_num; ++i ) {
// A little array trick here, assign to it as a 1D array.
// If it's not in bounds we're kinda hosed anyway.
set_radiation( { 0, rad_cell }, rad_strength );
rad_cell++;
if( rad_cell < SEEX * SEEY ) {
set_radiation( { 0 % SEEX, rad_cell / SEEX }, rad_strength );
rad_cell++;
}
}
}
} else if( member_name == "furniture" ) {
Expand Down

0 comments on commit 06b4143

Please sign in to comment.