Skip to content

Commit 3990a97

Browse files
committed
bugfix: check if connection is initialized before closing it
1 parent 168649f commit 3990a97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/src/main/java/org/kabiri/android/usbterminal/arduino/ArduinoHelper.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ internal class ArduinoHelper
9898

9999
fun disconnect() {
100100
try {
101-
connection.close()
101+
if (::connection.isInitialized) connection.close()
102102
_liveOutput.value = context.getString(R.string.helper_info_serial_connection_closed)
103103
} catch (e: UninitializedPropertyAccessException) {
104104
_liveErrorOutput.value =

0 commit comments

Comments
 (0)