Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segfault on certain scenarios #30122

Merged
merged 2 commits into from
Apr 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7076,8 +7076,15 @@ void item::process_temperature_rot( int temp, float insulation, const tripoint p
auto local_mod = g->new_game ? 0 : g->m.temperature( local );
const auto temp_modify = ( !g->new_game ) && ( g->m.ter( local ) == t_rootcellar );

int enviroment_mod = get_heat_radiation( pos, false );
enviroment_mod += get_convection_temperature( pos );
int enviroment_mod;
// Toilets and vending machines will try to get the heat radiation and convection during mapgen and segfault.
// So lets not take them into account for items that were created before calendar::start
if( to_turn<int>( last_temp_check ) > to_turn<int>( calendar::start ) ) {
enviroment_mod = get_heat_radiation( pos, false );
enviroment_mod += get_convection_temperature( pos );
} else {
enviroment_mod = 0;
}

if( carried ) {
local_mod += 5; // body heat increases inventory temperature
Expand Down