diff options
author | fxqnlr <[email protected]> | 2023-04-29 23:59:54 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-04-29 23:59:54 +0200 |
commit | 2b180daf1e2687436046b853c59e0abe12c50f57 (patch) | |
tree | 9a6a4ddc418270d69a153e9c2980247657066f08 /src/commands | |
parent | 41a844af34e4c51c5924fe48778aa1148ecdbfb7 (diff) | |
download | modlist-2b180daf1e2687436046b853c59e0abe12c50f57.tar modlist-2b180daf1e2687436046b853c59e0abe12c50f57.tar.gz modlist-2b180daf1e2687436046b853c59e0abe12c50f57.zip |
added fallback if no primaries, removed prints
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/modification.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/commands/modification.rs b/src/commands/modification.rs index ffc4e10..67cde0b 100644 --- a/src/commands/modification.rs +++ b/src/commands/modification.rs | |||
@@ -159,16 +159,20 @@ async fn get_mod_infos(config: Cfg, mod_ids: Vec<String>, list: List) -> MLE<Vec | |||
159 | .find(|v| v.id == current_id) | 159 | .find(|v| v.id == current_id) |
160 | .unwrap(), | 160 | .unwrap(), |
161 | ); | 161 | ); |
162 | 162 | ||
163 | file = current_version | 163 | // match primary, if none? |
164 | let files = current_version | ||
164 | .clone() | 165 | .clone() |
165 | .ok_or("") | 166 | .ok_or("") |
166 | .unwrap() | 167 | .unwrap() |
167 | .files | 168 | .files; |
168 | .into_iter() | 169 | |
169 | .find(|f| f.primary) | 170 | file = match files.clone().into_iter().find(|f| f.primary) { |
170 | .unwrap() | 171 | Some(f) => f, |
172 | None => { files[0].clone() } | ||
173 | } | ||
171 | .url; | 174 | .url; |
175 | |||
172 | for ver in available_versions { | 176 | for ver in available_versions { |
173 | available_versions_vec.push(ver.id); | 177 | available_versions_vec.push(ver.id); |
174 | } | 178 | } |