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 a crash when burning things #36471

Merged
merged 2 commits into from
Dec 26, 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
5 changes: 3 additions & 2 deletions src/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ void material_type::load( const JsonObject &jsobj, const std::string & )
for( JsonObject brn : jsobj.get_array( "burn_data" ) ) {
_burn_data.emplace_back( load_mat_burn_data( brn ) );
}
} else {
}
if( _burn_data.empty() ) {
// If not specified, supply default
mat_burn_data mbd;
if( _fire_resist <= 0 ) {
Expand Down Expand Up @@ -255,7 +256,7 @@ bool material_type::reinforces() const

const mat_burn_data &material_type::burn_data( size_t intensity ) const
{
return _burn_data[ std::min<size_t>( intensity, fd_fire.obj().get_max_intensity() ) - 1 ];
return _burn_data[ std::min<size_t>( intensity, _burn_data.size() ) - 1 ];
}

const mat_burn_products &material_type::burn_products() const
Expand Down