aboutsummaryrefslogtreecommitdiff
path: root/src-tauri
diff options
context:
space:
mode:
authorJan <sentrycraft123@gmail.com>2023-02-02 15:13:13 +0100
committerGitHub <noreply@github.com>2023-02-02 15:13:13 +0100
commit24cabc6019e702ac888a33311532a9832863b572 (patch)
treef29c4ed80d6b0161dfc9a124bcf27beed2b58bda /src-tauri
parent0f09fc76d4390811be71bc0e9a0e44a50ecb6440 (diff)
downloadFlightCore-24cabc6019e702ac888a33311532a9832863b572.tar.gz
FlightCore-24cabc6019e702ac888a33311532a9832863b572.zip
fix: Prevent ModsView from crashing if Northstar is not installed (#152)
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/src/mod_management/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs
index c37882fe..d269a627 100644
--- a/src-tauri/src/mod_management/mod.rs
+++ b/src-tauri/src/mod_management/mod.rs
@@ -196,7 +196,10 @@ fn parse_for_thunderstore_mod_string(nsmod_path: String) -> Result<String, anyho
fn parse_installed_mods(game_install: GameInstall) -> Result<Vec<NorthstarMod>, String> {
let ns_mods_folder = format!("{}/R2Northstar/mods/", game_install.game_path);
- let paths = std::fs::read_dir(ns_mods_folder).unwrap();
+ let paths = match std::fs::read_dir(ns_mods_folder) {
+ Ok(paths) => paths,
+ Err(_err) => return Err("No mods folder found".to_string()),
+ };
let mut directories: Vec<PathBuf> = Vec::new();
let mut mods: Vec<NorthstarMod> = Vec::new();