FileContentProvider: fix crash on certain upgrades

checkIfColumnExists should not use getColumnIndexOrThrow, as it's supposed to check if the index doesn't exist

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey Vilas 2022-02-11 13:57:03 +01:00
parent 5c649785f1
commit b5d338fb8d
No known key found for this signature in database
GPG key ID: 2585783189A62105

View file

@ -722,7 +722,7 @@ public class FileContentProvider extends ContentProvider {
private boolean checkIfColumnExists(SQLiteDatabase database, String table, String column) {
Cursor cursor = database.rawQuery("SELECT * FROM " + table + " LIMIT 0", null);
boolean exists = cursor.getColumnIndexOrThrow(column) != -1;
boolean exists = cursor.getColumnIndex(column) != -1;
cursor.close();
return exists;