Skip to content

Commit

Permalink
Crash fix on empty log file list
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyDude1994 committed Apr 29, 2021
1 parent 2fb0855 commit 3b7b614
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/src/main/java/crazydude/com/telemetry/ui/MapsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,11 @@ class MapsActivity : AppCompatActivity(), DataDecoder.Listener {
val dir = Environment.getExternalStoragePublicDirectory("TelemetryLogs")
if (dir.exists()) {
val files =
dir.listFiles { file -> file.extension == "log" && file.length() > 0 }
.reversed()
dir.listFiles { file -> file.extension == "log" && file.length() > 0 }?.reversed()
if (files == null) {
Toast.makeText(this, "No log files available", Toast.LENGTH_SHORT).show()
return
}
AlertDialog.Builder(this)
.setAdapter(
ArrayAdapter(
Expand Down

0 comments on commit 3b7b614

Please sign in to comment.