fix: crash when an instruction is issed while there are no sink inputs
This commit is contained in:
12
src/mixer.rs
12
src/mixer.rs
@@ -303,6 +303,12 @@ impl Mixer {
|
|||||||
pub fn select_next(&mut self) {
|
pub fn select_next(&mut self) {
|
||||||
let mut index_lock = self.selected_index.lock().unwrap();
|
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 {
|
match *index_lock {
|
||||||
Some(current_index) => {
|
Some(current_index) => {
|
||||||
let new_index: usize =
|
let new_index: usize =
|
||||||
@@ -328,6 +334,12 @@ impl Mixer {
|
|||||||
pub fn select_previous(&mut self) {
|
pub fn select_previous(&mut self) {
|
||||||
let mut index_lock = self.selected_index.lock().unwrap();
|
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 {
|
match *index_lock {
|
||||||
Some(current_index) => {
|
Some(current_index) => {
|
||||||
let new_index: usize = match current_index.overflowing_sub(1) {
|
let new_index: usize = match current_index.overflowing_sub(1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user