Skip to content

Commit

Permalink
bugfix: check if connection is initialized before closing it
Browse files Browse the repository at this point in the history
  • Loading branch information
superus8r committed Apr 6, 2024
1 parent 168649f commit 3990a97
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ internal class ArduinoHelper

fun disconnect() {
try {
connection.close()
if (::connection.isInitialized) connection.close()
_liveOutput.value = context.getString(R.string.helper_info_serial_connection_closed)
} catch (e: UninitializedPropertyAccessException) {
_liveErrorOutput.value =
Expand Down

0 comments on commit 3990a97

Please sign in to comment.