Skip to content
Open
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
10 changes: 10 additions & 0 deletions engine/player/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12072,6 +12072,11 @@ std::unique_ptr<expr_t> player_t::create_expression( util::string_view expressio
auto parts = util::string_split<util::string_view>( expression_str, "_" );
double percent = -1.0;

if ( parts.size() < 3 )
{
throw sc_invalid_apl_argument( fmt::format( "Invalid 'time_to_' expression '{}'.", expression_str ) );
}

if ( util::str_in_str_ci( parts[ 2 ], "die" ) )
{
percent = 0.0;
Expand Down Expand Up @@ -12828,6 +12833,11 @@ std::unique_ptr<expr_t> player_t::create_resource_expression( util::string_view
{
auto parts = util::string_split<util::string_view>( splits[ 1 ], "_" );

if ( parts.size() < 3 )
{
throw sc_invalid_apl_argument( fmt::format( "Invalid resource expression '{}'.", expression_str ) );
}

// foo.time_to_max
if ( util::str_in_str_ci( parts[ 2 ], "max" ) )
{
Expand Down
Loading