非法StateException错误

我最近从Java迁移到Kotlin,并将我的应用程序的代码转换为kotlin代码并发布了更改。但是现在有些用户报告说应用程序正在强制停止。 但是我和被测设备都没有面临这个问题。 当我检查崩溃页面。 它显示了这一点:

在这里输入图像说明

这是1018行的DatabaseHelper Class Code

在这里输入图像说明

fun getNotes(sqlCommand: String): MutableList { val result = ArrayList() val db = this.readableDatabase Log.e(LOG, sqlCommand) val cursor = db.rawQuery(sqlCommand, null) try { if (cursor!!.moveToFirst()) { do { val note = Note() note.id = cursor.getLong(cursor.getColumnIndex(KEY_ID)) note.title = DataEncryption.encryptDecrypt(cursor.getString(cursor.getColumnIndex(KEY_TITLE))) note.content = DataEncryption.encryptDecrypt(cursor.getString(cursor.getColumnIndex(KEY_CONTENT))) note.updatedAt = Date(cursor.getLong(cursor.getColumnIndex(KEY_UPDATED_AT))) note.color = cursor.getInt(cursor.getColumnIndex(KEY_COLOR)) note.favourite = cursor.getInt(cursor.getColumnIndex(KEY_FAVOURITE)) if (cursor.isNull(cursor.getInt(cursor.getColumnIndex(KEY_LOCKSTATUS)))) { note.lock_status = 0 } else { note.lock_status = cursor.getInt(cursor.getColumnIndex(KEY_LOCKSTATUS)) } note.reminderDate = cursor.getString(cursor.getColumnIndex(KEY_REMINDER_DATE)) note.reminderTime = cursor.getString(cursor.getColumnIndex(KEY_REMINDER_TIME)) if (cursor.isNull(cursor.getInt(cursor.getColumnIndex(KEY_REMINDER_STATUS)))) { note.reminderStatus = 0 } else { note.reminderStatus = cursor.getInt(cursor.getColumnIndex(KEY_REMINDER_STATUS)) } note.noteCategoryTitle = cursor.getString(cursor.getColumnIndex(KEY_CATEGORY_NOTE_TITLE)) note.noteCategoryStatus = cursor.getInt(cursor.getColumnIndex(KEY_CATEGORY_NOTE_STATUS)) note.checklist = cursor.getInt(cursor.getColumnIndex(KEY_CHECKLIST)) if (cursor.isNull(cursor.getInt(cursor.getColumnIndex(KEY_ALARM_REPEAT_STATUS)))) { note.alarmRepeatStatus = 0 } else { note.alarmRepeatStatus = cursor.getInt(cursor.getColumnIndex(KEY_ALARM_REPEAT_STATUS)) } result.add(note) } while (cursor.moveToNext()) } } finally { cursor?.close() } return result } 

有人请帮我解决。 帮助是高度赞赏。