Added proper nullptr check

This commit is contained in:
Alexander Kazakov 2020-04-12 20:17:41 +03:00
parent d252c59513
commit 2eb2e4cf41

View File

@ -239,20 +239,25 @@ protected:
StoragePtr table = nullptr;
TableStructureReadLockHolder lock;
try
if (need_lock_structure)
{
if (need_lock_structure)
table = tables_it->table();
if (table == nullptr)
{
// Table might have just been removed or detached for Lazy engine (see DatabaseLazy::tryGetTable())
continue;
}
try
{
table = tables_it->table();
lock = table->lockStructureForShare(
false, context.getCurrentQueryId(), context.getSettingsRef().lock_acquire_timeout);
}
}
catch (const Exception & e)
{
if (e.code() == ErrorCodes::TABLE_IS_DROPPED)
continue;
throw;
catch (const Exception & e)
{
if (e.code() == ErrorCodes::TABLE_IS_DROPPED)
continue;
throw;
}
}
++rows_count;