Skip to content

Commit 526fd77

Browse files
committed
Allow null in setString()
1 parent b106294 commit 526fd77

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

json.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,12 @@ void
543543
Json::setString(const char* value)
544544
{
545545
clear();
546-
type_ = String;
547-
new (&string_value) std::string(value);
546+
if (value) {
547+
type_ = String;
548+
new (&string_value) std::string(value);
549+
} else {
550+
type_ = Null;
551+
}
548552
}
549553

550554
void

0 commit comments

Comments
 (0)