* Fixing a bug in writeIntoLiveView method where blocks->front()

is called before checking if blocks vector is empty.
This commit is contained in:
Vitaliy Zakaznikov 2019-06-14 21:08:46 -04:00
parent d6d0404c48
commit 282ff6bfda

View File

@ -202,7 +202,7 @@ public:
} }
/// Need make new mergeable block structure match the other mergeable blocks /// Need make new mergeable block structure match the other mergeable blocks
if (!mergeable_blocks->front()->empty() && !new_mergeable_blocks->empty()) if (!mergeable_blocks->front()->empty())
{ {
auto sample_block = mergeable_blocks->front()->front(); auto sample_block = mergeable_blocks->front()->front();
auto sample_new_block = new_mergeable_blocks->front(); auto sample_new_block = new_mergeable_blocks->front();
@ -237,6 +237,9 @@ public:
blocks->push_back(this_block); blocks->push_back(this_block);
} }
if (blocks->empty())
return;
auto sample_block = blocks->front().cloneEmpty(); auto sample_block = blocks->front().cloneEmpty();
BlockInputStreamPtr new_data = std::make_shared<BlocksBlockInputStream>(std::make_shared<BlocksPtr>(blocks), sample_block); BlockInputStreamPtr new_data = std::make_shared<BlocksBlockInputStream>(std::make_shared<BlocksPtr>(blocks), sample_block);