Don't crash if a repo has zero apps/apks
Also, a couple of typo fixes
This commit is contained in:
parent
f4539b3803
commit
663a95c7a9
@ -305,7 +305,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!changes) {
|
if (!changes) {
|
||||||
Log.d("FDroid", "Not checking app details or compatibility, ecause all repos were up to date.");
|
Log.d("FDroid", "Not checking app details or compatibility, because all repos were up to date.");
|
||||||
} else {
|
} else {
|
||||||
sendStatus(STATUS_INFO, getString(R.string.status_checking_compatibility));
|
sendStatus(STATUS_INFO, getString(R.string.status_checking_compatibility));
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
List<App> appsToIgnore = AppProvider.Helper.findIgnored(this, projection);
|
List<App> appsToIgnore = AppProvider.Helper.findIgnored(this, projection);
|
||||||
for (App app : apps) {
|
for (App app : apps) {
|
||||||
boolean ignored = false;
|
boolean ignored = false;
|
||||||
for(App appIgnored : appsToIgnore) {
|
for (App appIgnored : appsToIgnore) {
|
||||||
if (appIgnored.id.equals(app.id)) {
|
if (appIgnored.id.equals(app.id)) {
|
||||||
ignored = true;
|
ignored = true;
|
||||||
break;
|
break;
|
||||||
@ -444,7 +444,9 @@ public class UpdateService extends IntentService implements ProgressListener {
|
|||||||
|
|
||||||
private List<String> getKnownAppIds(List<App> apps) {
|
private List<String> getKnownAppIds(List<App> apps) {
|
||||||
List<String> knownAppIds = new ArrayList<String>();
|
List<String> knownAppIds = new ArrayList<String>();
|
||||||
if (apps.size() > AppProvider.MAX_APPS_TO_QUERY) {
|
if (apps.size() == 0) {
|
||||||
|
// Do nothing
|
||||||
|
} else if (apps.size() > AppProvider.MAX_APPS_TO_QUERY) {
|
||||||
int middle = apps.size() / 2;
|
int middle = apps.size() / 2;
|
||||||
List<App> apps1 = apps.subList(0, middle);
|
List<App> apps1 = apps.subList(0, middle);
|
||||||
List<App> apps2 = apps.subList(middle, apps.size());
|
List<App> apps2 = apps.subList(middle, apps.size());
|
||||||
|
@ -103,6 +103,9 @@ public class ApkProvider extends FDroidProvider {
|
|||||||
*/
|
*/
|
||||||
public static List<Apk> knownApks(Context context,
|
public static List<Apk> knownApks(Context context,
|
||||||
List<Apk> apks, String[] fields) {
|
List<Apk> apks, String[] fields) {
|
||||||
|
if (apks.size() == 0) {
|
||||||
|
return new ArrayList<Apk>();
|
||||||
|
}
|
||||||
ContentResolver resolver = context.getContentResolver();
|
ContentResolver resolver = context.getContentResolver();
|
||||||
Uri uri = getContentUri(apks);
|
Uri uri = getContentUri(apks);
|
||||||
Cursor cursor = resolver.query(uri, fields, null, null, null);
|
Cursor cursor = resolver.query(uri, fields, null, null, null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user