fix null-pointer when switching themes
This commit is contained in:
parent
885b5d781a
commit
4fa641b482
|
@ -253,9 +253,11 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
||||||
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
int toolbarWidth = getToolbar().getWidth();
|
Toolbar t = getToolbar();
|
||||||
|
if (t == null) return;
|
||||||
|
int toolbarWidth = t.getWidth();
|
||||||
if (toolbarWidth == 0) return;
|
if (toolbarWidth == 0) return;
|
||||||
toolbar.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
t.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
|
|
||||||
int toolbarFrameWidth = toolbarFrame.getWidth();
|
int toolbarFrameWidth = toolbarFrame.getWidth();
|
||||||
int padding = toolbarWidth - toolbarFrameWidth;
|
int padding = toolbarWidth - toolbarFrameWidth;
|
||||||
|
|
Loading…
Reference in New Issue