avoid string in case of empty objects

This commit is contained in:
Niels Lohmann 2021-07-16 09:27:18 +02:00 committed by Chaoya Li
parent 3ff25174b2
commit fdb0f072cd
2 changed files with 50 additions and 44 deletions

View File

@ -1082,6 +1082,8 @@ class binary_reader
return false; return false;
} }
if (len != 0)
{
string_t key; string_t key;
if (len != std::size_t(-1)) if (len != std::size_t(-1))
{ {
@ -1116,6 +1118,7 @@ class binary_reader
key.clear(); key.clear();
} }
} }
}
return sax->end_object(); return sax->end_object();
} }

View File

@ -9307,6 +9307,8 @@ class binary_reader
return false; return false;
} }
if (len != 0)
{
string_t key; string_t key;
if (len != std::size_t(-1)) if (len != std::size_t(-1))
{ {
@ -9341,6 +9343,7 @@ class binary_reader
key.clear(); key.clear();
} }
} }
}
return sax->end_object(); return sax->end_object();
} }