diff --git a/engine/player/player.cpp b/engine/player/player.cpp index c4cc379832c..2c390c8d9a9 100644 --- a/engine/player/player.cpp +++ b/engine/player/player.cpp @@ -12568,19 +12568,22 @@ std::unique_ptr player_t::create_expression( util::string_view expressio if ( splits.size() == 2 && splits[ 0 ] == "potion" ) { + std::string default_potion_str; std::string_view potion_view; if ( !potion_str.empty() ) { potion_view = potion_str; } - else if ( default_potion().empty() ) - { - potion_view = default_potion(); - } else { - return expr_t::create_constant( expression_str, false ); + default_potion_str = default_potion(); + if ( default_potion_str.empty() ) + { + return expr_t::create_constant( expression_str, false ); + } + + potion_view = default_potion_str; } if ( util::str_compare_ci( potion_view, splits[ 1 ] ) )