From 282ff6bfda42c949b9d1a4921ad7f42435436526 Mon Sep 17 00:00:00 2001 From: Vitaliy Zakaznikov Date: Fri, 14 Jun 2019 21:08:46 -0400 Subject: [PATCH] * Fixing a bug in writeIntoLiveView method where blocks->front() is called before checking if blocks vector is empty. --- dbms/src/Storages/StorageLiveView.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dbms/src/Storages/StorageLiveView.h b/dbms/src/Storages/StorageLiveView.h index 01dd82ff1fd..69410ec4e8b 100644 --- a/dbms/src/Storages/StorageLiveView.h +++ b/dbms/src/Storages/StorageLiveView.h @@ -202,7 +202,7 @@ public: } /// 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_new_block = new_mergeable_blocks->front(); @@ -237,6 +237,9 @@ public: blocks->push_back(this_block); } + if (blocks->empty()) + return; + auto sample_block = blocks->front().cloneEmpty(); BlockInputStreamPtr new_data = std::make_shared(std::make_shared(blocks), sample_block);