fix: fatal exception `IllegalStateException` at CourseUnitWebViewFragment.java:192
Fix crash java.lang.IllegalStateException: Fragment CourseUnitWebViewFragment
`not attached to a context` in setupOpenInBrowserView.
fixes:
@@ -186,6 +186,7 @@ public class CourseUnitWebViewFragment extends CourseUnitFragment {
}
private void setupOpenInBrowserView() {
+ if (getContext() != null) {
@StringRes int linkTextResId = R.string.open_in_browser_text;
binding.tvOpenBrowser.setVisibility(View.VISIBLE);
@@ -227,6 +228,7 @@ public class CourseUnitWebViewFragment extends CourseUnitFragment {
trackOpenInBrowserBannerEvent(Analytics.Events.OPEN_IN_BROWSER_BANNER_DISPLAYED,
Analytics.Values.OPEN_IN_BROWSER_BANNER_DISPLAYED);
}
+ }
private void trackOpenInBrowserBannerEvent(String eventName, String biValue) {
environment.getAnalyticsRegistry().trackOpenInBrowserBannerEvent(eventName, biValue,
