XDXF: Fix indexing of the dictionaries with empty "abbreviation" field (issue #1132)

This commit is contained in:
Abs62 2019-03-17 23:04:14 +03:00
parent 7ef50ba50f
commit 247a076371

View file

@ -1323,13 +1323,13 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
list < wstring > keys; list < wstring > keys;
while( !( stream.isEndElement() && stream.name() == "abbreviations" ) && !stream.atEnd() ) while( !( stream.isEndElement() && stream.name() == "abbreviations" ) && !stream.atEnd() )
{ {
stream.readNext(); if( !stream.readNextStartElement() )
// abbreviations tag set switch at format revision = 30 break;
// abbreviations tag set switch at format revision = 30
if( idxHeader.revisionNumber >= 30 ) if( idxHeader.revisionNumber >= 30 )
{ {
while ( !( stream.isEndElement() && stream.name() == "abbr_def" ) || !stream.atEnd() ) while ( !( stream.isEndElement() && stream.name() == "abbr_def" ) || !stream.atEnd() )
{ {
stream.readNext();
if ( stream.isStartElement() && stream.name() == "abbr_k" ) if ( stream.isStartElement() && stream.name() == "abbr_k" )
{ {
s = readElementText( stream ); s = readElementText( stream );
@ -1347,13 +1347,13 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
} }
else if ( stream.isEndElement() && stream.name() == "abbreviations" ) else if ( stream.isEndElement() && stream.name() == "abbreviations" )
break; break;
stream.readNext();
} }
} }
else else
{ {
while ( !( stream.isEndElement() && stream.name() == "abr_def" ) || !stream.atEnd() ) while ( !( stream.isEndElement() && stream.name() == "abr_def" ) || !stream.atEnd() )
{ {
stream.readNext();
if ( stream.isStartElement() && stream.name() == "k" ) if ( stream.isStartElement() && stream.name() == "k" )
{ {
s = readElementText( stream ); s = readElementText( stream );
@ -1371,6 +1371,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
} }
else if ( stream.isEndElement() && stream.name() == "abbreviations" ) else if ( stream.isEndElement() && stream.name() == "abbreviations" )
break; break;
stream.readNext();
} }
} }
} }