Prevent crash

This commit is contained in:
M66B
2022-07-14 15:16:55 +02:00
parent f36c141922
commit 27610fbd73
9 changed files with 27 additions and 36 deletions

View File

@@ -63,6 +63,7 @@ import java.text.SimpleDateFormat;
import java.util.Locale;
public class FragmentOptionsPrivacy extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
private View view;
private ImageButton ibHelp;
private SwitchCompat swConfirmLinks;
private SwitchCompat swCheckLinksDbl;
@@ -123,7 +124,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
setSubtitle(R.string.title_setup);
setHasOptionsMenu(true);
View view = inflater.inflate(R.layout.fragment_options_privacy, container, false);
view = inflater.inflate(R.layout.fragment_options_privacy, container, false);
// Get controls
@@ -529,9 +530,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
}
private void setOptions() {
if (getContext() == null)
return;
if (getLifecycle().getCurrentState().equals(Lifecycle.State.DESTROYED))
if (view == null || getContext() == null)
return;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());