summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-08-31 22:08:41 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-08-31 22:08:41 (GMT)
commitfdc8eb61a417af22dac8bc97dd5f19f728c80060 (patch)
treed95dea5fb3e2af0a15edde1920c22b1dc47dfdc9
parent1b247d9f37cd1e9ca9e8c690c137858b66314b79 (diff)
parent23c8f48f4334b0ac0752b320dad2c1fc5ef095f3 (diff)
downloadandroid_packages_apps_Trebuchet-fdc8eb61a417af22dac8bc97dd5f19f728c80060.zip
android_packages_apps_Trebuchet-fdc8eb61a417af22dac8bc97dd5f19f728c80060.tar.gz
android_packages_apps_Trebuchet-fdc8eb61a417af22dac8bc97dd5f19f728c80060.tar.bz2
Merge "Fixing NPE in recycler view scroll bar." into ub-launcher3-burnaby
-rw-r--r--src/com/android/launcher3/widget/WidgetsRecyclerView.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/com/android/launcher3/widget/WidgetsRecyclerView.java b/src/com/android/launcher3/widget/WidgetsRecyclerView.java
index 3dcb332..884bdc4 100644
--- a/src/com/android/launcher3/widget/WidgetsRecyclerView.java
+++ b/src/com/android/launcher3/widget/WidgetsRecyclerView.java
@@ -88,6 +88,12 @@ public class WidgetsRecyclerView extends BaseRecyclerView {
*/
@Override
public String scrollToPositionAtProgress(float touchFraction) {
+ // Skip early if widgets are not bound.
+ if (mWidgets == null) {
+ return "";
+ }
+
+ // Skip early if there are no widgets.
int rowCount = mWidgets.getPackageSize();
if (rowCount == 0) {
return "";
@@ -112,9 +118,13 @@ public class WidgetsRecyclerView extends BaseRecyclerView {
*/
@Override
public void onUpdateScrollbar(int dy) {
- int rowCount = mWidgets.getPackageSize();
+ // Skip early if widgets are not bound.
+ if (mWidgets == null) {
+ return;
+ }
- // Skip early if, there are no items.
+ // Skip early if there are no widgets.
+ int rowCount = mWidgets.getPackageSize();
if (rowCount == 0) {
mScrollbar.setThumbOffset(-1, -1);
return;
@@ -138,9 +148,13 @@ public class WidgetsRecyclerView extends BaseRecyclerView {
stateOut.rowTopOffset = -1;
stateOut.rowHeight = -1;
- int rowCount = mWidgets.getPackageSize();
+ // Skip early if widgets are not bound.
+ if (mWidgets == null) {
+ return;
+ }
// Return early if there are no items
+ int rowCount = mWidgets.getPackageSize();
if (rowCount == 0) {
return;
}