Skip to content

Commit

Permalink
fix null case for GetJsonLength (#3734) (#3737)
Browse files Browse the repository at this point in the history
close #2705
  • Loading branch information
ti-chi-bot authored Apr 14, 2022
1 parent ea72b21 commit d35821a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dbms/src/Storages/Transaction/JSONCodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
*/
namespace DB
{

namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
Expand Down Expand Up @@ -277,6 +276,10 @@ String DecodeJsonAsBinary(size_t & cursor, const String & raw_value) { return De

UInt64 GetJsonLength(std::string_view raw_value)
{
if (raw_value.empty())
{
return 0;
}
switch (raw_value[0]) // JSON Root element type
{
case TYPE_CODE_OBJECT:
Expand Down

0 comments on commit d35821a

Please sign in to comment.