Avoid crashes when appid or repoUri are empty
This commit is contained in:
parent
40904ab75f
commit
78e2e1bcc4
@ -197,7 +197,6 @@ public class AppDetails extends ListActivity {
|
||||
setContentView(R.layout.appdetails);
|
||||
|
||||
Intent i = getIntent();
|
||||
appid = "";
|
||||
Uri data = i.getData();
|
||||
if (data != null) {
|
||||
if (data.isHierarchical()) {
|
||||
@ -328,6 +327,7 @@ public class AppDetails extends ListActivity {
|
||||
|
||||
Log.d("FDroid", "Getting application details for " + appid);
|
||||
app = null;
|
||||
if (appid != null && appid.length() > 0) {
|
||||
List<DB.App> apps = ((FDroidApp) getApplication()).getApps();
|
||||
for (DB.App tapp : apps) {
|
||||
if (tapp.id.equals(appid)) {
|
||||
@ -335,6 +335,7 @@ public class AppDetails extends ListActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (app == null) {
|
||||
Toast toast = Toast.makeText(this,
|
||||
getString(R.string.no_such_app), Toast.LENGTH_LONG);
|
||||
|
@ -89,14 +89,14 @@ public class FDroid extends FragmentActivity {
|
||||
String appid = data.getQueryParameter("fdid");
|
||||
// If appid == null, we just browse all the apps.
|
||||
// If appid != null, we browse the app specified.
|
||||
if (appid != null) {
|
||||
if (appid != null && appid.length() > 0) {
|
||||
Intent call = new Intent(this, AppDetails.class);
|
||||
call.putExtra("appid", appid);
|
||||
startActivityForResult(call, REQUEST_APPDETAILS);
|
||||
}
|
||||
} else {
|
||||
String repoUri = data.getEncodedSchemeSpecificPart();
|
||||
if (repoUri != null) {
|
||||
if (repoUri != null && repoUri.length() > 0) {
|
||||
Intent call = new Intent(this, ManageRepo.class);
|
||||
call.putExtra("repoUri", repoUri);
|
||||
startActivityForResult(call, REQUEST_MANAGEREPOS);
|
||||
|
@ -82,8 +82,7 @@ public class ManageRepo extends ListActivity {
|
||||
|
||||
Intent i = getIntent();
|
||||
if (i.hasExtra("repoUri")) {
|
||||
String repoUri = i.getStringExtra("repoUri");
|
||||
addRepo(repoUri);
|
||||
addRepo(i.getStringExtra("repoUri"));
|
||||
finish();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user