Fixed some crashes

- Import playlist crash
- Create new backup crash
This commit is contained in:
Prathamesh More 2021-12-13 10:53:40 +05:30
parent ac902d0bf0
commit 5e08b889c1
3 changed files with 11 additions and 5 deletions

View file

@ -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)
}