forked from Anri/cal8tor
don't crash when the selected courses don't have multiples TP/TD options
This commit is contained in:
parent
220f46c5de
commit
77c2444de1
1 changed files with 10 additions and 7 deletions
|
@ -104,13 +104,16 @@ fn tdtp(timetable: &mut Timetable) {
|
||||||
let mut multiselected: Vec<String> = td_or_tp.iter().map(get_selection).collect();
|
let mut multiselected: Vec<String> = td_or_tp.iter().map(get_selection).collect();
|
||||||
multiselected.sort();
|
multiselected.sort();
|
||||||
|
|
||||||
|
let mut selections = vec![];
|
||||||
|
if !multiselected.is_empty() {
|
||||||
let defaults = vec![false; multiselected.len()];
|
let defaults = vec![false; multiselected.len()];
|
||||||
let selections = MultiSelect::new()
|
selections = MultiSelect::new()
|
||||||
.with_prompt(format!("Choisis tes horaires de TD/TP {}", DISCLAIMER))
|
.with_prompt(format!("Choisis tes horaires de TD/TP {}", DISCLAIMER))
|
||||||
.items(&multiselected[..])
|
.items(&multiselected[..])
|
||||||
.defaults(&defaults[..])
|
.defaults(&defaults[..])
|
||||||
.interact()
|
.interact()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
// Keep only wanted courses
|
// Keep only wanted courses
|
||||||
for day in &mut timetable.1 .1 {
|
for day in &mut timetable.1 .1 {
|
||||||
|
|
Loading…
Reference in a new issue