Merge pull request #12792 from JosJuice/android-vibrators-crash

Android: Fix crash when no devices have outputs
This commit is contained in:
Admiral H. Curtiss 2024-05-23 00:04:05 +02:00 committed by GitHub
commit e0e09d1074
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -101,8 +101,8 @@ class AdvancedMappingDialog(
return return
} else if (!isInput) { } else if (!isInput) {
// Find the first device that has an output. (Most built-in devices don't have any) // Find the first device that has an output. (Most built-in devices don't have any)
val deviceWithOutputs = devices.first { deviceHasOutputs(it) } val deviceWithOutputs = devices.firstOrNull { deviceHasOutputs(it) }
if (deviceWithOutputs.isNotEmpty()) { if (deviceWithOutputs != null) {
setSelectedDevice(deviceWithOutputs) setSelectedDevice(deviceWithOutputs)
binding.dropdownDevice.setText(deviceWithOutputs, false) binding.dropdownDevice.setText(deviceWithOutputs, false)
return return