Small cursor null, count and close()
This commit is contained in:
parent
0506160f7b
commit
05aa6a39fa
@ -493,9 +493,12 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
AppProvider.getCanUpdateUri(),
|
AppProvider.getCanUpdateUri(),
|
||||||
AppProvider.DataColumns.ALL,
|
AppProvider.DataColumns.ALL,
|
||||||
null, null, null);
|
null, null, null);
|
||||||
|
if (cursor != null) {
|
||||||
if (cursor.getCount() > 0) {
|
if (cursor.getCount() > 0) {
|
||||||
showAppUpdatesNotification(cursor);
|
showAppUpdatesNotification(cursor);
|
||||||
}
|
}
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PendingIntent createNotificationIntent() {
|
private PendingIntent createNotificationIntent() {
|
||||||
|
@ -24,9 +24,11 @@ public class AppProvider extends FDroidProvider {
|
|||||||
final String[] projection = { AppProvider.DataColumns._COUNT };
|
final String[] projection = { AppProvider.DataColumns._COUNT };
|
||||||
Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
|
Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (cursor != null && cursor.getCount() == 1) {
|
if (cursor != null) {
|
||||||
|
if (cursor.getCount() == 1) {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
count = cursor.getInt(0);
|
count = cursor.getInt(0);
|
||||||
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
@ -34,6 +34,7 @@ public class InstalledAppProvider extends FDroidProvider {
|
|||||||
final String[] projection = InstalledAppProvider.DataColumns.ALL;
|
final String[] projection = InstalledAppProvider.DataColumns.ALL;
|
||||||
Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
|
Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
|
if (cursor.getCount() > 0) {
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
while (!cursor.isAfterLast()) {
|
while (!cursor.isAfterLast()) {
|
||||||
cachedInfo.put(
|
cachedInfo.put(
|
||||||
@ -42,6 +43,7 @@ public class InstalledAppProvider extends FDroidProvider {
|
|||||||
);
|
);
|
||||||
cursor.moveToNext();
|
cursor.moveToNext();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user