mirror of
https://github.com/libexpat/libexpat.git
synced 2025-04-07 06:04:59 +00:00
tests: Exit parser_stop_character_handler if parser is finished
When test_repeated_stop_parser_between_char_data_calls runs without chunking the input -- which I am about to do in my next commit -- the parser_stop_character_handler callback happens multiple times. This is because stopping the parser doesn't stop all callbacks immediately, which is valid (documented) behavior. The second callback tried to stop the parser again, getting unexpected errors. Let's check the parser status on entry and return early if it's already finished.
This commit is contained in:
parent
e1dc3383e3
commit
b4d2b76a97
1 changed files with 5 additions and 0 deletions
|
@ -1573,6 +1573,11 @@ parser_stop_character_handler(void *userData, const XML_Char *s, int len) {
|
|||
UNUSED_P(userData);
|
||||
UNUSED_P(s);
|
||||
UNUSED_P(len);
|
||||
XML_ParsingStatus status;
|
||||
XML_GetParsingStatus(g_parser, &status);
|
||||
if (status.parsing == XML_FINISHED) {
|
||||
return; // the parser was stopped by a previous call to this handler.
|
||||
}
|
||||
XML_StopParser(g_parser, g_resumable);
|
||||
XML_SetCharacterDataHandler(g_parser, NULL);
|
||||
if (! g_resumable) {
|
||||
|
|
Loading…
Add table
Reference in a new issue