2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-22 09:58:08 +00:00

Fix crash

This commit is contained in:
Maxim Leshchenko 2021-06-26 12:44:52 +03:00 committed by Albert Vaca Cintora
parent d43c9aa325
commit a6339312e4

View File

@ -167,10 +167,10 @@ class RunCommandControlsProviderService : ControlsProviderService() {
val controlIdParts = controlId.split("-")
val device = BackgroundService.getInstance().getDevice(controlIdParts[0])
if (!device.isPaired) return null
if (device == null || !device.isPaired) return null
val commandList = if (device.isReachable) {
device?.getPlugin(RunCommandPlugin::class.java)?.commandList?.map { jsonObject ->
device.getPlugin(RunCommandPlugin::class.java)?.commandList?.map { jsonObject ->
CommandEntryWithDevice(jsonObject.getString("name"), jsonObject.getString("command"), jsonObject.getString("key"), device)
}
} else {