From 8aaf605270358e19d12f0a3269ad998e3725993d Mon Sep 17 00:00:00 2001 From: Zhang Hu Date: Fri, 10 May 2019 00:11:04 +0800 Subject: [PATCH] fix null table pointer issue --- src/metadata.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/metadata.cpp b/src/metadata.cpp index cefa8e1a5..8e6c7b276 100644 --- a/src/metadata.cpp +++ b/src/metadata.cpp @@ -2407,7 +2407,7 @@ void Metadata::InternalData::update_indexes(int protocol_version, const VersionN std::string index_name; KeyspaceMetadata* keyspace = NULL; - TableMetadata::Ptr table; + TableMetadata::Ptr table(NULL); while (rows.next()) { std::string temp_keyspace_name; @@ -2434,7 +2434,9 @@ void Metadata::InternalData::update_indexes(int protocol_version, const VersionN table->clear_indexes(); } - table->add_index(IndexMetadata::from_row(index_name, buffer, row)); + if (table) { + table->add_index(IndexMetadata::from_row(index_name, buffer, row)); + } } }