fixing rare NPE

test: replaced callback with null pointer and noted same crash error as provided in bug. testing crash to see if it was just small jank or obvious crash. its an obvious cash to user. by exiting earlier the UI isn't as fluid but we will stop crashing.

bug: 261071811
Change-Id: Ia54ee8d4bccdb9de8c042bae8e837216eaac67bb
This commit is contained in:
Randy Pfohl committed 2023-03-07 16:16:46 +00:00
1 parent d0838d3ac1
commit 583241e655
1 file changed
+8 -2
+8 -2
View File
@@ -1370,8 +1370,14 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
int velocity = (int) mOrientationHandler.getPrimaryVelocity(velocityTracker,
mActivePointerId);
float delta = primaryDirection - mDownMotionPrimary;
int pageOrientedSize = (int) (mOrientationHandler.getMeasuredSize(
getPageAt(mCurrentPage))
View current = getPageAt(mCurrentPage);
if (current == null) {
Log.e(TAG, "current page was null. this should not happen.");
return true;
}
int pageOrientedSize = (int) (mOrientationHandler.getMeasuredSize(current)
* mOrientationHandler.getPrimaryScale(this));
boolean isSignificantMove = isSignificantMove(Math.abs(delta), pageOrientedSize);