Fix crash when trying to load cache that does not exist

This commit is contained in:
Jacob Dufault 2017-05-08 18:21:21 -07:00
parent a97bd9d1c4
commit d1287f8fc8

View File

@ -953,11 +953,12 @@ bool ImportCachedIndex(IndexerConfig* config,
for (auto& dependency_path : cache->dependencies) {
std::cerr << "- Got dependency " << dependency_path << std::endl;
std::unique_ptr<IndexedFile> cache = LoadCachedIndex(config, dependency_path);
if (GetLastModificationTime(cache->path) == cache->last_modification_time)
if (cache && GetLastModificationTime(cache->path) == cache->last_modification_time)
file_consumer_shared->Mark(cache->path);
else
needs_reparse = true;
queue_do_id_map->Enqueue(Index_DoIdMap(std::move(cache)));
if (cache)
queue_do_id_map->Enqueue(Index_DoIdMap(std::move(cache)));
}
// Import primary file.