if a note cannot be loaded, still load the other ones

This commit is contained in:
tibbi 2017-03-07 19:51:55 +01:00
parent 8d7a6c0c36
commit 4e845db003

@ -90,12 +90,16 @@ class DBHelper private constructor(private val mContext: Context) : SQLiteOpenHe
cursor = mDb.query(TABLE_NAME, cols, null, null, null, null, "$COL_TITLE COLLATE NOCASE ASC") cursor = mDb.query(TABLE_NAME, cols, null, null, null, null, "$COL_TITLE COLLATE NOCASE ASC")
if (cursor?.moveToFirst() == true) { if (cursor?.moveToFirst() == true) {
do { do {
val id = cursor.getIntValue(COL_ID) try {
val title = cursor.getStringValue(COL_TITLE) val id = cursor.getIntValue(COL_ID)
val value = cursor.getStringValue(COL_VALUE) val title = cursor.getStringValue(COL_TITLE)
val type = cursor.getIntValue(COL_TYPE) val value = cursor.getStringValue(COL_VALUE)
val note = Note(id, title, value, type) val type = cursor.getIntValue(COL_TYPE)
notes.add(note) val note = Note(id, title, value, type)
notes.add(note)
} catch (e: Exception) {
continue
}
} while (cursor.moveToNext()) } while (cursor.moveToNext())
} }
} finally { } finally {