From 628bf49779b857074226e6acc71f951dddd0d1ed Mon Sep 17 00:00:00 2001 From: Alex Kasko Date: Sat, 20 Jul 2024 10:45:58 +0100 Subject: [PATCH] Add string empty checks to stripQuoteFromId Signed-off-by: Alex Kasko --- contrib/babelfishpg_tsql/src/tsqlIface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/babelfishpg_tsql/src/tsqlIface.cpp b/contrib/babelfishpg_tsql/src/tsqlIface.cpp index 06a9d32d96c..d8c760cf7ed 100644 --- a/contrib/babelfishpg_tsql/src/tsqlIface.cpp +++ b/contrib/babelfishpg_tsql/src/tsqlIface.cpp @@ -359,12 +359,12 @@ stripQuoteFromId(TSqlParser::IdContext *ctx) std::string stripQuoteFromId(std::string s) { - if (s.front() == '[') + if (!s.empty() && s.front() == '[') { Assert(s.back() == ']'); return s.substr(1,s.length()-2); } - else if (s.front() == '"') + else if (!s.empty() && s.front() == '"') { Assert(s.back() == '"'); return s.substr(1,s.length()-2);