NPE fix
This commit is contained in:
@@ -27,6 +27,13 @@ public class ViewContactActivity extends ActionBarActivity {
|
||||
Bundle args = getIntent().getExtras();
|
||||
if (args != null)
|
||||
destination = args.getString(ViewContactFragment.ADDRESS);
|
||||
|
||||
if (destination == null) {
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
ViewContactFragment f = ViewContactFragment.newInstance(destination);
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add(android.R.id.content, f).commit();
|
||||
|
||||
@@ -27,6 +27,13 @@ public class ViewIdentityActivity extends ActionBarActivity {
|
||||
Bundle args = getIntent().getExtras();
|
||||
if (args != null)
|
||||
key = args.getString(ViewIdentityFragment.ADDRESS);
|
||||
|
||||
if (key == null) {
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
ViewIdentityFragment f = ViewIdentityFragment.newInstance(key);
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add(android.R.id.content, f).commit();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package i2p.bote.android.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -111,6 +112,11 @@ public abstract class ViewAddressFragment extends Fragment {
|
||||
|
||||
if (mAddress != null) {
|
||||
loadAddress();
|
||||
} else {
|
||||
// No address provided, finish
|
||||
// Should not happen
|
||||
getActivity().setResult(Activity.RESULT_CANCELED);
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user