Skip to content
This repository was archived by the owner on Sep 13, 2022. It is now read-only.

Commit 4bbe549

Browse files
committed
Fix bug with empty lines
- Just like in ZPar, empty lines should be skipped properly.
1 parent 10ec1e7 commit 4bbe549

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/zpar.lib.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ extern "C" char* dep_parse_sentence(void* vzps, const char *input_sentence, bool
423423
strcpy(zps->output_buffer, "");
424424
}
425425

426-
return zps->output_buffer;
426+
return zps->output_buffer;
427427
}
428428

429429
// Function to dependency parse a sentence
@@ -510,7 +510,7 @@ extern "C" void tag_file(void* vzps, const char *sInputFile, const char *sOutput
510510
}
511511
while ( readSomething )
512512
{
513-
if ( tokenized_sent->back() == "\n" )
513+
if ( !tokenized_sent->empty() && tokenized_sent->back() == "\n" )
514514
{
515515
tokenized_sent->pop_back();
516516
}
@@ -569,7 +569,7 @@ extern "C" void parse_file(void* vzps, const char *sInputFile, const char *sOutp
569569

570570
while ( readSomething )
571571
{
572-
if ( tokenized_sent->back() == "\n" )
572+
if ( !tokenized_sent->empty() && tokenized_sent->back() == "\n" )
573573
{
574574
tokenized_sent->pop_back();
575575
}
@@ -679,7 +679,7 @@ extern "C" void dep_parse_file(void* vzps, const char *sInputFile, const char *s
679679

680680
while ( readSomething )
681681
{
682-
if ( tokenized_sent->back() == "\n" )
682+
if ( !tokenized_sent->empty() && tokenized_sent->back() == "\n" )
683683
{
684684
tokenized_sent->pop_back();
685685
}

0 commit comments

Comments
 (0)