Fix null pointer exception when surveys are turned off
Under certain conditions the provider could be null on download completion which could lead to a NPE if surveys are disabled. The method to remove the receiver has been made static so an instance is no longer required. Test: robotests Bug: 33707203 Change-Id: Icfb545697f24172db734dd7dad421796edf68186
This commit is contained in:
@@ -74,9 +74,8 @@ public class SurveyMixin implements LifecycleObserver, OnResume, OnPause {
|
||||
public void onPause() {
|
||||
Activity activity = mFragment.getActivity();
|
||||
if (mReceiver != null && activity != null) {
|
||||
SurveyFeatureProvider provider =
|
||||
FeatureFactory.getFactory(activity).getSurveyFeatureProvider(activity);
|
||||
provider.unregisterReceiver(activity, mReceiver);
|
||||
SurveyFeatureProvider.unregisterReceiver(activity, mReceiver);
|
||||
mReceiver = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user