diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java index bf169373e..7f7dfcb79 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java @@ -253,9 +253,11 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { - int toolbarWidth = getToolbar().getWidth(); + Toolbar t = getToolbar(); + if (t == null) return; + int toolbarWidth = t.getWidth(); if (toolbarWidth == 0) return; - toolbar.getViewTreeObserver().removeOnGlobalLayoutListener(this); + t.getViewTreeObserver().removeOnGlobalLayoutListener(this); int toolbarFrameWidth = toolbarFrame.getWidth(); int padding = toolbarWidth - toolbarFrameWidth;