Handle Empty SampleRates Cont
Prevents crashes when input/output devices report no sample rates by defaulting to the current rate or 48 kHz if needed Provides a fallback option in the UI so the selected rate is visible even when the device list is empty
This commit is contained in:
@@ -520,7 +520,8 @@ const JackServerSettingsDialog = withStyles(
|
||||
let sampleRates = selectedInputDevice && selectedOutputDevice ?
|
||||
intersectArrays(selectedInputDevice.sampleRates, selectedOutputDevice.sampleRates)
|
||||
: (selectedInputDevice ? selectedInputDevice.sampleRates : (selectedOutputDevice ? selectedOutputDevice.sampleRates : []));
|
||||
|
||||
let sampleRateOptions = sampleRates.length === 0 ? [this.state.jackServerSettings.sampleRate || 48000] : sampleRates;
|
||||
|
||||
return (
|
||||
<DialogEx tag="jack" onClose={handleClose} aria-labelledby="select-channels-title" open={open}
|
||||
onEnterKey={() => {
|
||||
@@ -589,7 +590,7 @@ const JackServerSettingsDialog = withStyles(
|
||||
}
|
||||
}}
|
||||
>
|
||||
{sampleRates.map((sr) => {
|
||||
{sampleRateOptions.map((sr) => {
|
||||
return (<MenuItem value={sr}>{sr}</MenuItem> );
|
||||
})}
|
||||
</Select>
|
||||
|
||||
Reference in New Issue
Block a user