Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.3.0版本报空指针异常 #188

Open
minorlai opened this issue Aug 2, 2019 · 0 comments
Open

1.3.0版本报空指针异常 #188

minorlai opened this issue Aug 2, 2019 · 0 comments

Comments

@minorlai
Copy link

minorlai commented Aug 2, 2019

APP点击home键放置后台,点击app重启的时候mContentView为null,导致
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getWidth()' on a null object reference

麻烦尽快处理

public void scrollToFinishActivity() {
final int childWidth = mContentView.getWidth();
final int childHeight = mContentView.getHeight();

    int left = 0, top = 0;
    if ((mEdgeFlag & EDGE_LEFT) != 0) {
        left = childWidth + mShadowLeft.getIntrinsicWidth() + OVERSCROLL_DISTANCE;
        mTrackingEdge = EDGE_LEFT;
    } else if ((mEdgeFlag & EDGE_RIGHT) != 0) {
        left = -childWidth - mShadowRight.getIntrinsicWidth() - OVERSCROLL_DISTANCE;
        mTrackingEdge = EDGE_RIGHT;
    } else if ((mEdgeFlag & EDGE_BOTTOM) != 0) {
        top = -childHeight - mShadowBottom.getIntrinsicHeight() - OVERSCROLL_DISTANCE;
        mTrackingEdge = EDGE_BOTTOM;
    }

    mDragHelper.smoothSlideViewTo(mContentView, left, top);
    invalidate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant