Closed jason-hwang closed 2 years ago
cursor.getString can make the CursorIndexOutOfBoundsException when the cursor's length of the database is zero.
cursor.getString
CursorIndexOutOfBoundsException
The situation can happen when the READ_EXTERNAL_STORAGE permission is not allowed by the OS ( >= Android 12)
READ_EXTERNAL_STORAGE
Add a guard for the case that the cursor's length of the database is zero.
Problem
cursor.getString
can make theCursorIndexOutOfBoundsException
when the cursor's length of the database is zero.Situation
The situation can happen when the
READ_EXTERNAL_STORAGE
permission is not allowed by the OS ( >= Android 12)Solution
Add a guard for the case that the cursor's length of the database is zero.