From 500379801bb8c27c1822fd1540dbcf3c1e16a8aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=93=D0=B0=D1=80?= =?UTF-8?q?=D0=B1=D0=B0=D1=80?= Date: Wed, 27 Mar 2024 23:09:14 +0300 Subject: [PATCH] Check query_settings nullptr --- src/Databases/DatabaseOrdinary.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Databases/DatabaseOrdinary.cpp b/src/Databases/DatabaseOrdinary.cpp index 65d5f21bbea..f4191727b7c 100644 --- a/src/Databases/DatabaseOrdinary.cpp +++ b/src/Databases/DatabaseOrdinary.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include @@ -128,10 +127,10 @@ void DatabaseOrdinary::convertMergeTreeToReplicatedIfNeeded(ASTPtr ast, const Qu /// Get table's storage policy MergeTreeSettings default_settings = getContext()->getMergeTreeSettings(); - auto * query_settings = create_query->storage->settings->as(); auto policy = getContext()->getStoragePolicy(default_settings.storage_policy); - if (Field * policy_setting = query_settings->changes.tryGet("storage_policy")) - policy = getContext()->getStoragePolicy(policy_setting->get()); + if (auto * query_settings = create_query->storage->settings->as()) + if (Field * policy_setting = query_settings->changes.tryGet("storage_policy")) + policy = getContext()->getStoragePolicy(policy_setting->safeGet()); auto convert_to_replicated_flag_path = getConvertToReplicatedFlagPath(qualified_name.table, policy, false);