Fix optional dereferences

This commit is contained in:
theoreticalbts 2015-12-16 17:02:21 -05:00
parent 7cae3501f8
commit d60c8a255e
2 changed files with 10 additions and 2 deletions

View file

@ -442,7 +442,12 @@ uint32_t database::push_applied_operation( const operation& op )
void database::set_applied_operation_result( uint32_t op_id, const operation_result& result )
{
assert( op_id < _applied_ops.size() );
_applied_ops[op_id]->result = result;
if( _applied_ops[op_id] )
_applied_ops[op_id]->result = result;
else
{
elog( "Could not set operation result (head_block_num=${b})", ("b", head_block_num()) );
}
}
const vector<optional< operation_history_object > >& database::get_applied_operations() const

View file

@ -218,7 +218,10 @@ void market_history_plugin_impl::update_market_histories( const signed_block& b
graphene::chain::database& db = database();
const vector<optional< operation_history_object > >& hist = db.get_applied_operations();
for( const optional< operation_history_object >& o_op : hist )
o_op->op.visit( operation_process_fill_order( _self, b.timestamp ) );
{
if( o_op.valid() )
o_op->op.visit( operation_process_fill_order( _self, b.timestamp ) );
}
}
} // end namespace detail