提交 1e147f56 编写于 作者: P Paul 提交者: Takeshi Hagikura

Fixed issue #474 (#490)

* Fixed issue 474, canScrollHorizontally() throws NPE if the RecyclerView is not attached to the Window
上级 7bf1ce78
......@@ -1898,7 +1898,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
if (mFlexWrap == FlexWrap.NOWRAP) {
return isMainAxisDirectionHorizontal();
} else {
return !isMainAxisDirectionHorizontal() || getWidth() > mParent.getWidth();
return !isMainAxisDirectionHorizontal() || getWidth() > (mParent != null ? mParent.getWidth() : 0);
}
}
......@@ -1907,7 +1907,7 @@ public class FlexboxLayoutManager extends RecyclerView.LayoutManager implements
if (mFlexWrap == FlexWrap.NOWRAP) {
return !isMainAxisDirectionHorizontal();
} else {
return isMainAxisDirectionHorizontal() || getHeight() > mParent.getHeight();
return isMainAxisDirectionHorizontal() || getHeight() > (mParent != null ? mParent.getHeight() : 0);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册