diff --git a/app/build.gradle b/app/build.gradle index f1b08e5..3567ec3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -18,8 +18,8 @@ android { applicationId "eu.zderadicka.audioserve" minSdkVersion 21 targetSdkVersion 27 - versionCode 16 - versionName "0.6.9" + versionCode 17 + versionName "0.6.10" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/java/eu/zderadicka/audioserve/SettingsActivity.kt b/app/src/main/java/eu/zderadicka/audioserve/SettingsActivity.kt index f70696f..ec8986d 100644 --- a/app/src/main/java/eu/zderadicka/audioserve/SettingsActivity.kt +++ b/app/src/main/java/eu/zderadicka/audioserve/SettingsActivity.kt @@ -151,10 +151,12 @@ class SettingsFragment: PreferenceFragment(), SharedPreferences.OnSharedPreferen l.add(Pair(getString(sname) + " (${freeSize(sfile.freeSpace)})",sfile.absolutePath)) activity.externalMediaDirs.forEachIndexed { index, file -> - if (Environment.getExternalStorageState(file) == Environment.MEDIA_MOUNTED) { - val name = getString(R.string.storage_external, index.toString()) - l.add(Pair(name+ " (${freeSize(file.freeSpace)})",file.absolutePath)) - } + + if (file != null && Environment.getExternalStorageState(file) == Environment.MEDIA_MOUNTED) { + val name = getString(R.string.storage_external, index.toString()) + l.add(Pair(name + " (${freeSize(file.freeSpace)})", file.absolutePath)) + } + } return l }