Skip to content

Commit

Permalink
Add string empty checks to stripQuoteFromId
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Kasko <[email protected]>
  • Loading branch information
staticlibs committed Jul 20, 2024
1 parent 7fb4f6b commit 628bf49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/babelfishpg_tsql/src/tsqlIface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 628bf49

Please sign in to comment.