mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
fix limit variable to prevent NPE
This commit is contained in:
parent
b02d4378fa
commit
20681be134
1 changed files with 10 additions and 8 deletions
|
@ -675,14 +675,14 @@ public class FileContentProvider extends ContentProvider {
|
|||
Log_OC.i(SQL, "Entering in onUpgrade");
|
||||
boolean upgraded = false;
|
||||
if (oldVersion == 1 && newVersion >= 2) {
|
||||
Log_OC.i(SQL, "Entering in the #1 ADD in onUpgrade");
|
||||
Log_OC.i(SQL, "Entering in the #2 ADD in onUpgrade");
|
||||
db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
|
||||
ADD_COLUMN + ProviderTableMeta.FILE_KEEP_IN_SYNC + " INTEGER " +
|
||||
" DEFAULT 0");
|
||||
upgraded = true;
|
||||
}
|
||||
if (oldVersion < 3 && newVersion >= 3) {
|
||||
Log_OC.i(SQL, "Entering in the #2 ADD in onUpgrade");
|
||||
Log_OC.i(SQL, "Entering in the #3 ADD in onUpgrade");
|
||||
db.beginTransaction();
|
||||
try {
|
||||
db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
|
||||
|
@ -702,7 +702,7 @@ public class FileContentProvider extends ContentProvider {
|
|||
}
|
||||
}
|
||||
if (oldVersion < 4 && newVersion >= 4) {
|
||||
Log_OC.i(SQL, "Entering in the #3 ADD in onUpgrade");
|
||||
Log_OC.i(SQL, "Entering in the #4 ADD in onUpgrade");
|
||||
db.beginTransaction();
|
||||
try {
|
||||
db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
|
||||
|
@ -726,7 +726,7 @@ public class FileContentProvider extends ContentProvider {
|
|||
}
|
||||
|
||||
if (oldVersion < 5 && newVersion >= 5) {
|
||||
Log_OC.i(SQL, "Entering in the #4 ADD in onUpgrade");
|
||||
Log_OC.i(SQL, "Entering in the #5 ADD in onUpgrade");
|
||||
db.beginTransaction();
|
||||
try {
|
||||
db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
|
||||
|
@ -744,7 +744,7 @@ public class FileContentProvider extends ContentProvider {
|
|||
}
|
||||
|
||||
if (oldVersion < 6 && newVersion >= 6) {
|
||||
Log_OC.i(SQL, "Entering in the #5 ADD in onUpgrade");
|
||||
Log_OC.i(SQL, "Entering in the #6 ADD in onUpgrade");
|
||||
db.beginTransaction();
|
||||
try {
|
||||
db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
|
||||
|
@ -985,7 +985,7 @@ public class FileContentProvider extends ContentProvider {
|
|||
}
|
||||
|
||||
if (oldVersion < 20 && newVersion >= 20) {
|
||||
Log_OC.i(SQL, "Adding arbitrary data table");
|
||||
Log_OC.i(SQL, "Entering in the #20 Adding arbitrary data table");
|
||||
db.beginTransaction();
|
||||
try {
|
||||
createArbitraryData(db);
|
||||
|
@ -1017,8 +1017,8 @@ public class FileContentProvider extends ContentProvider {
|
|||
|
||||
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver);
|
||||
|
||||
final List<MediaFolder> imageMediaFolders = MediaProvider.getImageFolders(contentResolver, 0);
|
||||
final List<MediaFolder> videoMediaFolders = MediaProvider.getVideoFolders(contentResolver, 0);
|
||||
final List<MediaFolder> imageMediaFolders = MediaProvider.getImageFolders(contentResolver, 1);
|
||||
final List<MediaFolder> videoMediaFolders = MediaProvider.getVideoFolders(contentResolver, 1);
|
||||
|
||||
ArrayList<Long> idsToDelete = new ArrayList<>();
|
||||
List<SyncedFolder> syncedFolders = syncedFolderProvider.getSyncedFolders();
|
||||
|
@ -1053,6 +1053,8 @@ public class FileContentProvider extends ContentProvider {
|
|||
|
||||
upgraded = true;
|
||||
db.setTransactionSuccessful();
|
||||
} catch (Throwable t) {
|
||||
Log_OC.e(TAG, "ERROR!", t);
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue