mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 09:31:59 +00:00
Don't parse version for json if there is no expected version.
This commit is contained in:
parent
1d98797f26
commit
35c407b2ac
@ -359,13 +359,13 @@ std::unique_ptr<IndexFile> Deserialize(SerializeFormat format,
|
|||||||
switch (format) {
|
switch (format) {
|
||||||
case SerializeFormat::Json: {
|
case SerializeFormat::Json: {
|
||||||
rapidjson::Document reader;
|
rapidjson::Document reader;
|
||||||
if (gTestOutputMode)
|
if (gTestOutputMode || !expected_version) {
|
||||||
reader.Parse(serialized_index_content.c_str());
|
reader.Parse(serialized_index_content.c_str());
|
||||||
else {
|
} else {
|
||||||
const char* p = strchr(serialized_index_content.c_str(), '\n');
|
const char* p = strchr(serialized_index_content.c_str(), '\n');
|
||||||
if (!p)
|
if (!p)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (expected_version && atoi(serialized_index_content.c_str()) != *expected_version)
|
if (atoi(serialized_index_content.c_str()) != *expected_version)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
reader.Parse(p + 1);
|
reader.Parse(p + 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user