From 35c407b2ace21c713e1ab87955eaa02f1b9df527 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Sun, 11 Feb 2018 17:14:27 -0800 Subject: [PATCH] Don't parse version for json if there is no expected version. --- src/serializer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/serializer.cc b/src/serializer.cc index 6ea6e3e3..953c2601 100644 --- a/src/serializer.cc +++ b/src/serializer.cc @@ -359,13 +359,13 @@ std::unique_ptr Deserialize(SerializeFormat format, switch (format) { case SerializeFormat::Json: { rapidjson::Document reader; - if (gTestOutputMode) + if (gTestOutputMode || !expected_version) { reader.Parse(serialized_index_content.c_str()); - else { + } else { const char* p = strchr(serialized_index_content.c_str(), '\n'); if (!p) return nullptr; - if (expected_version && atoi(serialized_index_content.c_str()) != *expected_version) + if (atoi(serialized_index_content.c_str()) != *expected_version) return nullptr; reader.Parse(p + 1); }