Fix LoadCachedIndex crash if deserialization failed.

This commit is contained in:
Jacob Dufault 2017-08-15 20:29:09 -07:00
parent 7faedfdf00
commit 81594a1497

View File

@ -33,7 +33,8 @@ std::unique_ptr<IndexFile> LoadCachedIndex(Config* config,
return nullptr;
auto result = Deserialize(filename, *file_content, IndexFile::kCurrentVersion);
result->is_loaded_from_cache_ = true;
if (result)
result->is_loaded_from_cache_ = true;
return result;
}