@ -81,15 +81,13 @@ StringParameter *StringParameters::GetNextParameterPointer()
{
assert ( this - > next_type = = 0 | | ( SCC_CONTROL_START < = this - > next_type & & this - > next_type < = SCC_CONTROL_END ) ) ;
if ( this - > offset > = this - > parameters . size ( ) ) {
Debug ( misc , 0 , " Trying to read invalid string parameter " ) ;
return nullptr ;
throw std : : out_of_range ( " Trying to read invalid string parameter " ) ;
}
auto & param = this - > parameters [ this - > offset + + ] ;
if ( param . type ! = 0 & & param . type ! = this - > next_type ) {
Debug ( misc , 0 , " Trying to read string parameter with wrong type " ) ;
this - > next_type = 0 ;
return nullptr ;
throw std : : out_of_range ( " Trying to read string parameter with wrong type " ) ;
}
param . type = this - > next_type ;
this - > next_type = 0 ;
@ -903,6 +901,7 @@ static void FormatString(StringBuilder &builder, const char *str_arg, StringPara
str_stack . push ( str_arg ) ;
for ( ; ; ) {
try {
while ( ! str_stack . empty ( ) & & ( b = Utf8Consume ( & str_stack . top ( ) ) ) = = ' \0 ' ) {
str_stack . pop ( ) ;
}
@ -1105,7 +1104,7 @@ static void FormatString(StringBuilder &builder, const char *str_arg, StringPara
case SCC_RAW_STRING_POINTER : { // {RAW_STRING}
const char * raw_string = args . GetNextParameterString ( ) ;
/* raw_string can be (come) nullptr when the parameter is out of range and 0 is returned instead . */
/* raw_string can be nullptr. */
if ( raw_string = = nullptr ) {
builder + = " (invalid RAW_STRING parameter) " ;
break ;
@ -1631,6 +1630,10 @@ static void FormatString(StringBuilder &builder, const char *str_arg, StringPara
builder . Utf8Encode ( b ) ;
break ;
}
} catch ( std : : out_of_range & e ) {
Debug ( misc , 0 , " FormatString: {} " , e . what ( ) ) ;
builder + = " (invalid parameter) " ;
}
}
}