mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
Fix a possible null reference bug
This commit is contained in:
@@ -177,7 +177,7 @@ public abstract class KeyAgreementActivity extends BriarActivity implements
|
|||||||
// FIXME #824
|
// FIXME #824
|
||||||
FragmentManager fm = getSupportFragmentManager();
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
if (fm.findFragmentByTag(KeyAgreementFragment.TAG) == null) {
|
if (fm.findFragmentByTag(KeyAgreementFragment.TAG) == null) {
|
||||||
BaseFragment f = KeyAgreementFragment.newInstance(this);
|
BaseFragment f = KeyAgreementFragment.newInstance();
|
||||||
fm.beginTransaction()
|
fm.beginTransaction()
|
||||||
.replace(R.id.fragmentContainer, f, f.getUniqueTag())
|
.replace(R.id.fragmentContainer, f, f.getUniqueTag())
|
||||||
.addToBackStack(f.getUniqueTag())
|
.addToBackStack(f.getUniqueTag())
|
||||||
|
|||||||
@@ -91,15 +91,19 @@ public class KeyAgreementFragment extends BaseEventFragment
|
|||||||
private KeyAgreementTask task;
|
private KeyAgreementTask task;
|
||||||
private KeyAgreementEventListener listener;
|
private KeyAgreementEventListener listener;
|
||||||
|
|
||||||
public static KeyAgreementFragment newInstance(
|
public static KeyAgreementFragment newInstance() {
|
||||||
KeyAgreementEventListener listener) {
|
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
KeyAgreementFragment fragment = new KeyAgreementFragment();
|
KeyAgreementFragment fragment = new KeyAgreementFragment();
|
||||||
fragment.listener = listener;
|
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
listener = (KeyAgreementEventListener) context;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void injectFragment(ActivityComponent component) {
|
public void injectFragment(ActivityComponent component) {
|
||||||
component.inject(this);
|
component.inject(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user