From 81594a14971b30d0044cb92e2d826098db2d09d0 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Tue, 15 Aug 2017 20:29:09 -0700 Subject: [PATCH] Fix LoadCachedIndex crash if deserialization failed. --- src/cache.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cache.cc b/src/cache.cc index 8e8cab5b..871d7e7f 100644 --- a/src/cache.cc +++ b/src/cache.cc @@ -33,7 +33,8 @@ std::unique_ptr 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; }