add more check + line break

This commit is contained in:
Duc Canh Le 2023-07-05 15:04:38 +00:00
parent 1a0b2d0e24
commit 8f1ed5c90d
2 changed files with 4 additions and 4 deletions

View File

@ -12,15 +12,15 @@ namespace ErrorCodes
template <typename T>
T checkAndGetLiteralArgument(const ASTPtr & arg, const String & arg_name)
{
if (arg->as<ASTLiteral>())
if (arg && arg->as<ASTLiteral>())
return checkAndGetLiteralArgument<T>(*arg->as<ASTLiteral>(), arg_name);
throw Exception(
ErrorCodes::BAD_ARGUMENTS,
"Argument '{}' must be a literal, get {} (value: {})",
arg_name,
arg->getID(),
arg->formatForErrorMessage());
arg ? arg->getID() : "NULL",
arg ? arg->formatForErrorMessage() : "NULL");
}
template <typename T>