From 8e8160be28f4d0017280ba70de680b9c39a698eb Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 8 May 2021 21:11:31 +0300 Subject: [PATCH] Fix error --- src/Storages/System/StorageSystemTables.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Storages/System/StorageSystemTables.cpp b/src/Storages/System/StorageSystemTables.cpp index 7046a37766c..9d00a9b71c4 100644 --- a/src/Storages/System/StorageSystemTables.cpp +++ b/src/Storages/System/StorageSystemTables.cpp @@ -389,8 +389,8 @@ protected: src_index += 2; StorageMetadataPtr metadata_snapshot; - assert(table != nullptr); - metadata_snapshot = table->getInMemoryMetadataPtr(); + if (table) + metadata_snapshot = table->getInMemoryMetadataPtr(); ASTPtr expression_ptr; if (columns_mask[src_index++]) @@ -427,7 +427,7 @@ protected: if (columns_mask[src_index++]) { - auto policy = table->getStoragePolicy(); + auto policy = table ? table->getStoragePolicy() : nullptr; if (policy) res_columns[res_index++]->insert(policy->getName()); else @@ -436,7 +436,7 @@ protected: if (columns_mask[src_index++]) { - auto total_rows = table->totalRows(context->getSettingsRef()); + auto total_rows = table ? table->totalRows(context->getSettingsRef()) : std::nullopt; if (total_rows) res_columns[res_index++]->insert(*total_rows); else @@ -445,7 +445,7 @@ protected: if (columns_mask[src_index++]) { - auto total_bytes = table->totalBytes(context->getSettingsRef()); + auto total_bytes = table ? table->totalBytes(context->getSettingsRef()) : std::nullopt; if (total_bytes) res_columns[res_index++]->insert(*total_bytes); else @@ -454,7 +454,7 @@ protected: if (columns_mask[src_index++]) { - auto lifetime_rows = table->lifetimeRows(); + auto lifetime_rows = table ? table->lifetimeRows() : std::nullopt; if (lifetime_rows) res_columns[res_index++]->insert(*lifetime_rows); else @@ -463,7 +463,7 @@ protected: if (columns_mask[src_index++]) { - auto lifetime_bytes = table->lifetimeBytes(); + auto lifetime_bytes = table ? table->lifetimeBytes() : std::nullopt; if (lifetime_bytes) res_columns[res_index++]->insert(*lifetime_bytes); else