fix: crash when an instruction is issed while there are no sink inputs

This commit is contained in:
2024-06-29 13:41:59 +02:00
parent fa5c1c53f1
commit 88e40cd27a

View File

@@ -303,6 +303,12 @@ impl Mixer {
pub fn select_next(&mut self) {
let mut index_lock = self.selected_index.lock().unwrap();
let sink_input_len = self.sink_inputs.len();
if sink_input_len == 0 {
*index_lock = None;
return;
}
match *index_lock {
Some(current_index) => {
let new_index: usize =
@@ -328,6 +334,12 @@ impl Mixer {
pub fn select_previous(&mut self) {
let mut index_lock = self.selected_index.lock().unwrap();
let sink_input_len = self.sink_inputs.len();
if sink_input_len == 0 {
*index_lock = None;
return;
}
match *index_lock {
Some(current_index) => {
let new_index: usize = match current_index.overflowing_sub(1) {