diff --git a/src/item.cpp b/src/item.cpp index acf767eff3fbf..e6608093e6e6d 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -7367,14 +7367,13 @@ const use_function *item::get_use_internal( const std::string &use_name ) const item *item::get_usable_item( const std::string &use_name ) { - if( type != nullptr && type->get_use( use_name ) != nullptr ) { - return this; - } - item *ret = nullptr; - contents.visit_contents( - [&ret, &use_name]( item * it, item * ) { - if( it->get_use( use_name ) != nullptr ) { + visit_items( + [&ret, &use_name]( item * it ) { + if( it == nullptr ) { + return VisitResponse::SKIP; + } + if( it->get_use_internal( use_name ) ) { ret = it; return VisitResponse::ABORT; } diff --git a/src/item_action.cpp b/src/item_action.cpp index d08479dc598be..d5b4d72a22ef3 100644 --- a/src/item_action.cpp +++ b/src/item_action.cpp @@ -273,7 +273,11 @@ void game::item_action_menu() } const auto method = elem.second->get_use( elem.first ); - return std::make_tuple( method->get_type(), method->get_name(), ss ); + if( method ) { + return std::make_tuple( method->get_type(), method->get_name(), ss ); + } else { + return std::make_tuple( errstring, std::string( "NO USE FUNCTION" ), ss ); + } } ); // Sort mapped actions. sort_menu( menu_items.begin(), menu_items.end() );