Add missing chck for empty range while flushing

This commit is contained in:
Marcin Junczys-Dowmunt 2015-01-22 22:18:19 +01:00
parent 769c19d10c
commit 4140756fdf
2 changed files with 13 additions and 7 deletions

View File

@ -258,8 +258,10 @@ void LexicalReorderingTableCreator::FlushEncodedQueue(bool force)
if(force) {
m_lastFlushedLine = -1;
m_hash.AddRange(m_lastRange);
m_lastRange.clear();
if(!m_lastRange.empty()) {
m_hash.AddRange(m_lastRange);
m_lastRange.clear();
}
#ifdef WITH_THREADS
m_hash.WaitAll();
@ -377,7 +379,6 @@ void EncodingTaskReordering::operator()()
encodedLine, i);
result.push_back(packedItem);
}
lines.clear();
{
#ifdef WITH_THREADS
@ -388,6 +389,7 @@ void EncodingTaskReordering::operator()()
m_creator.FlushEncodedQueue();
}
lines.clear();
result.clear();
lines.reserve(max_lines);
result.reserve(max_lines);

View File

@ -878,8 +878,10 @@ void PhraseTableCreator::FlushRankedQueue(bool force)
}
if(force) {
m_rnkHash.AddRange(m_lastSourceRange);
m_lastSourceRange.clear();
if(!m_lastSourceRange.empty()) {
m_rnkHash.AddRange(m_lastSourceRange);
m_lastSourceRange.clear();
}
#ifdef WITH_THREADS
m_rnkHash.WaitAll();
@ -963,8 +965,10 @@ void PhraseTableCreator::FlushEncodedQueue(bool force)
m_lastCollection.clear();
}
m_srcHash.AddRange(m_lastSourceRange);
m_lastSourceRange.clear();
if(!m_lastSourceRange.empty()) {
m_srcHash.AddRange(m_lastSourceRange);
m_lastSourceRange.clear();
}
#ifdef WITH_THREADS
m_srcHash.WaitAll();