Skip to content

Commit

Permalink
catch incorrect component strings (#73442)
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon authored Jun 2, 2024
1 parent aff61cc commit 55c740a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/requirements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ void tool_comp::load( const JsonValue &value )
comp.read( 0, type, true );
count = comp.get_int( 1 );
requirement = comp.size() > 2 && comp.get_string( 2 ) == "LIST";
if( comp.size() > 2 && comp.get_string( 2 ) != "LIST" ) {
value.throw_error( R"(expected "LIST")" );
}
}
if( count == 0 ) {
value.throw_error( "tool count must not be 0" );
Expand Down Expand Up @@ -273,6 +276,8 @@ void item_comp::load( const JsonValue &value )
recoverable = false;
} else if( flag == "LIST" ) {
requirement = true;
} else {
value.throw_error( R"(expected "LIST" or "NO_RECOVER")" );
}
}
if( count <= 0 ) {
Expand Down

0 comments on commit 55c740a

Please sign in to comment.