From f9dd78700934cccc264c8ca58dfd245010385e16 Mon Sep 17 00:00:00 2001 From: sk Date: Wed, 31 May 2023 00:19:38 +0200 Subject: [PATCH] fix rules crashing the app closes sk22#535 --- .../joinmastodon/android/fragments/SettingsFragment.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java index 0804404b6..12f82c510 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java @@ -326,11 +326,11 @@ public class SettingsFragment extends MastodonToolbarFragment{ items.add(new TextItem(R.string.sk_settings_auth, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/auth/edit"), R.drawable.ic_fluent_open_24_regular)); items.add(new HeaderItem(instanceName)); - items.add(new TextItem(R.string.sk_settings_rules, ()->{ - Bundle args=new Bundle(); - args.putParcelable("instance", Parcels.wrap(instance)); + items.add(new TextItem(R.string.sk_settings_rules, instance.map(i -> () -> { + Bundle args = new Bundle(); + args.putParcelable("instance", Parcels.wrap(i)); Nav.go(getActivity(), InstanceRulesFragment.class, args); - }, R.drawable.ic_fluent_task_list_ltr_24_regular)); + }).orElse(null), R.drawable.ic_fluent_task_list_ltr_24_regular)); items.add(new TextItem(R.string.sk_settings_about_instance , ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/about"), R.drawable.ic_fluent_info_24_regular)); items.add(new TextItem(R.string.settings_tos, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/terms"), R.drawable.ic_fluent_open_24_regular)); items.add(new TextItem(R.string.settings_privacy_policy, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/terms"), R.drawable.ic_fluent_open_24_regular));