Merge branch 'stable-fixes' into 'master'

fix crasher bug in 0.75

    fix divide-by-zero crash when a repo has less than 25 apps in it

    This was introduced in e4401ed22c0f65db5d4f1a1f0e1222b061e471af

See merge request !39
This commit is contained in:
Peter Serwylo 2014-10-07 21:27:40 +00:00
commit 4ba45ba66f
2 changed files with 9 additions and 3 deletions

View File

@ -20,6 +20,7 @@
package org.fdroid.fdroid;
import android.os.Bundle;
import org.fdroid.fdroid.data.Apk;
import org.fdroid.fdroid.data.App;
import org.fdroid.fdroid.data.Repo;
@ -29,7 +30,8 @@ import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import java.text.ParseException;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
public class RepoXMLHandler extends DefaultHandler {
@ -279,7 +281,8 @@ public class RepoXMLHandler extends DefaultHandler {
} else if (localName.equals("application") && curapp == null) {
curapp = new App();
curapp.id = attributes.getValue("", "id");
if (progressCounter % (totalAppCount / 25) == 0) {
/* show progress for the first 25, then start skipping every 25 */
if (totalAppCount < 25 || progressCounter % (totalAppCount / 25) == 0) {
Bundle data = new Bundle(1);
data.putString(RepoUpdater.PROGRESS_DATA_REPO_ADDRESS, repo.address);
progressListener.onProgress(

View File

@ -463,7 +463,10 @@ public class ManageReposActivity extends ActionBarActivity {
if (!TextUtils.isEmpty(newRepo.getBssid())) {
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
String bssid = wifiInfo.getBSSID().toLowerCase(Locale.ENGLISH);
String bssid = wifiInfo.getBSSID();
if (TextUtils.isEmpty(bssid)) /* not all devices have wifi */
return;
bssid = bssid.toLowerCase(Locale.ENGLISH);
String newRepoBssid = Uri.decode(newRepo.getBssid()).toLowerCase(Locale.ENGLISH);
if (!bssid.equals(newRepoBssid)) {
String msg = String.format(getString(R.string.not_on_same_wifi), newRepo.getSsid());