From b147027e586f1bfce2600ea5671497c88831e1f0 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 10 Nov 2023 17:20:12 -0500 Subject: [PATCH] Allow exists() to return false if all index files are invalid --- src/gamedata.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gamedata.rs b/src/gamedata.rs index 94f1ec1..2018ff3 100755 --- a/src/gamedata.rs +++ b/src/gamedata.rs @@ -156,11 +156,11 @@ impl GameData { let index_path = self.get_index_filename(path); self.cache_index_file(&index_path); - let index_file = self - .get_index_file(&index_path) - .expect("Failed to find index file."); - - index_file.entries.iter().any(|s| s.hash == hash) + if let Some(index_file) = self.get_index_file(&index_path) { + index_file.entries.iter().any(|s| s.hash == hash) + } else { + false + } } /// Extracts the file located at `path`. This is returned as an in-memory buffer, and will usually