Fixed some crashes
- Import playlist crash - Create new backup crash
This commit is contained in:
parent
ac902d0bf0
commit
5e08b889c1
3 changed files with 11 additions and 5 deletions
|
@ -22,6 +22,7 @@ import code.name.monkey.retromusic.extensions.colorButtons
|
|||
import code.name.monkey.retromusic.extensions.materialDialog
|
||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||
import java.lang.Exception
|
||||
|
||||
class ImportPlaylistDialog : DialogFragment() {
|
||||
private val libraryViewModel by sharedViewModel<LibraryViewModel>()
|
||||
|
@ -30,7 +31,11 @@ class ImportPlaylistDialog : DialogFragment() {
|
|||
return materialDialog(R.string.import_playlist)
|
||||
.setMessage(R.string.import_playlist_message)
|
||||
.setPositiveButton(R.string.import_label) { _, _ ->
|
||||
libraryViewModel.importPlaylists()
|
||||
try {
|
||||
libraryViewModel.importPlaylists()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
.create()
|
||||
.colorButtons()
|
||||
|
|
|
@ -20,7 +20,7 @@ import android.database.Cursor
|
|||
|
||||
internal fun Cursor.getInt(columnName: String): Int {
|
||||
try {
|
||||
return this.getInt(this.getColumnIndex(columnName))
|
||||
return getInt(getColumnIndexOrThrow(columnName))
|
||||
} catch (ex: Throwable) {
|
||||
throw IllegalStateException("invalid column $columnName", ex)
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ internal fun Cursor.getInt(columnName: String): Int {
|
|||
|
||||
internal fun Cursor.getLong(columnName: String): Long {
|
||||
try {
|
||||
return this.getLong(this.getColumnIndex(columnName))
|
||||
return getLong(getColumnIndexOrThrow(columnName))
|
||||
} catch (ex: Throwable) {
|
||||
throw IllegalStateException("invalid column $columnName", ex)
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ internal fun Cursor.getLong(columnName: String): Long {
|
|||
|
||||
internal fun Cursor.getString(columnName: String): String {
|
||||
try {
|
||||
return this.getString(this.getColumnIndex(columnName))
|
||||
return getString(getColumnIndexOrThrow(columnName))
|
||||
} catch (ex: Throwable) {
|
||||
throw IllegalStateException("invalid column $columnName", ex)
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ internal fun Cursor.getString(columnName: String): String {
|
|||
|
||||
internal fun Cursor.getStringOrNull(columnName: String): String? {
|
||||
try {
|
||||
return this.getString(this.getColumnIndex(columnName))
|
||||
return getString(getColumnIndexOrThrow(columnName))
|
||||
} catch (ex: Throwable) {
|
||||
throw IllegalStateException("invalid column $columnName", ex)
|
||||
}
|
||||
|
|
|
@ -99,5 +99,6 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
|
|||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
ViewCompat.setOnApplyWindowInsetsListener(requireActivity().window.decorView, null)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue