diff options
author | Milo Yip <miloyip@gmail.com> | 2016-09-03 18:37:00 +0300 |
---|---|---|
committer | Milo Yip <miloyip@gmail.com> | 2016-09-03 18:37:00 +0300 |
commit | 3e2172bd52308bc57db0b5930347ce451b6cc0f8 (patch) | |
tree | 6f8bbc96732e5be724aca359d5682edc8640f427 /include/rapidjson/prettywriter.h | |
parent | 8979c14fb6ad68c5dacb4802f160b69f1235536b (diff) |
Add preconditions in writer and string functions
Diffstat (limited to 'include/rapidjson/prettywriter.h')
-rw-r--r-- | include/rapidjson/prettywriter.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/rapidjson/prettywriter.h b/include/rapidjson/prettywriter.h index 0dcb0fee..c6f0216e 100644 --- a/include/rapidjson/prettywriter.h +++ b/include/rapidjson/prettywriter.h @@ -91,12 +91,14 @@ public: bool Double(double d) { PrettyPrefix(kNumberType); return Base::WriteDouble(d); } bool RawNumber(const Ch* str, SizeType length, bool copy = false) { + RAPIDJSON_ASSERT(str != 0); (void)copy; PrettyPrefix(kNumberType); return Base::WriteString(str, length); } bool String(const Ch* str, SizeType length, bool copy = false) { + RAPIDJSON_ASSERT(str != 0); (void)copy; PrettyPrefix(kStringType); return Base::WriteString(str, length); @@ -184,7 +186,11 @@ public: \param type Type of the root of json. \note When using PrettyWriter::RawValue(), the result json may not be indented correctly. */ - bool RawValue(const Ch* json, size_t length, Type type) { PrettyPrefix(type); return Base::WriteRawValue(json, length); } + bool RawValue(const Ch* json, size_t length, Type type) { + RAPIDJSON_ASSERT(json != 0); + PrettyPrefix(type); + return Base::WriteRawValue(json, length); + } protected: void PrettyPrefix(Type type) { |