diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp index 1150f0d5da465..4f85b344102fe 100644 --- a/src/activity_item_handling.cpp +++ b/src/activity_item_handling.cpp @@ -1322,10 +1322,14 @@ static activity_reason_info can_do_activity_there( const activity_id &act, Chara if( here.has_flag_furn( ter_furn_flag::TFLAG_GROWTH_HARVEST, src_loc ) ) { map_stack items = here.i_at( src_loc ); - const map_stack::iterator seed = std::find_if( items.begin(), items.end(), []( const item & it ) { + const map_stack::iterator seed_iter = + std::find_if( items.begin(), items.end(), []( const item & it ) { return it.is_seed(); } ); - if( seed->has_flag( json_flag_CUT_HARVEST ) ) { + if( seed_iter == items.end() ) { + debugmsg( "Missing seed item at %s", src_loc.to_string() ); + return activity_reason_info::fail( do_activity_reason::ALREADY_DONE ); + } else if( seed_iter->has_flag( json_flag_CUT_HARVEST ) ) { // The plant in this location needs a grass cutting tool. if( you.has_quality( quality_id( qual_GRASS_CUT ), 1 ) ) { return activity_reason_info::ok( do_activity_reason::NEEDS_CUT_HARVESTING );