Don't crash if a link points at a nonexistent package (fixes #167)

For now, nothing happens. This should be improved.
This commit is contained in:
Daniel Martí 2013-07-06 13:35:58 +02:00
parent c7db510dad
commit 0d099a0126

View File

@ -233,7 +233,10 @@ public class AppDetails extends ListActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
if (resetRequired) { if (resetRequired) {
reset(); if (!reset()) {
finish();
return;
}
resetRequired = false; resetRequired = false;
} }
resetViews(); resetViews();
@ -288,7 +291,8 @@ public class AppDetails extends ListActivity {
// Reset the display and list contents. Used when entering the activity, and // Reset the display and list contents. Used when entering the activity, and
// also when something has been installed/uninstalled. // also when something has been installed/uninstalled.
private void reset() { // Return true if the app was found, false otherwise.
private boolean reset() {
Log.d("FDroid", "Getting application details for " + appid); Log.d("FDroid", "Getting application details for " + appid);
app = null; app = null;
@ -301,7 +305,7 @@ public class AppDetails extends ListActivity {
} }
if (app == null) { if (app == null) {
finish(); finish();
return; return false;
} }
// Make sure the app is populated. // Make sure the app is populated.
@ -336,7 +340,7 @@ public class AppDetails extends ListActivity {
mInstalledSignature = null; mInstalledSignature = null;
} }
} }
return true;
} }
private void resetViews() { private void resetViews() {