safeguard for UsbService nullability

because of the Java interface implying it
This commit is contained in:
Ken Van Hoeylandt 2020-09-17 19:55:36 +02:00
parent f97bc21719
commit 8de116bb01

View file

@ -9,4 +9,4 @@ import android.hardware.usb.UsbManager
*/
val Context.bluetoothManager: BluetoothManager? get() = getSystemService(Context.BLUETOOTH_SERVICE) as? BluetoothManager?
val Context.usbManager: UsbManager get() = requireNotNull(getSystemService(Context.USB_SERVICE) as? UsbManager) { "USB_SERVICE is not available"}
val Context.usbManager: UsbManager get() = requireNotNull(getSystemService(Context.USB_SERVICE) as? UsbManager?) { "USB_SERVICE is not available"}