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