diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 86d521f11d89..6119d8373f92 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -592,7 +592,7 @@ void KeywordInfo::KeywordElement::init( Databases const *pDatabases,helpdatafile if( idx == std::u16string_view::npos ) break; size_t h = ids.find( '#', k ); - if( h == std::u16string_view::npos || h < idx ) + if( h != std::u16string_view::npos && h < idx ) { // found an anchor id.push_back( OUString(ids.substr( k, h-k )) );