summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/widget
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-08-31 22:18:49 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-31 22:18:49 +0000
commit747f2b66e8a4b641a39b51735b92c4efb801ac86 (patch)
treefa96dc52f751c9360be20b49a78fa01c4bfc64a0 /src/com/android/launcher3/widget
parentf4d017999a51e983b4997ef2e9513d508a718cb2 (diff)
parentfdc8eb61a417af22dac8bc97dd5f19f728c80060 (diff)
downloadandroid_packages_apps_Trebuchet-747f2b66e8a4b641a39b51735b92c4efb801ac86.tar.gz
android_packages_apps_Trebuchet-747f2b66e8a4b641a39b51735b92c4efb801ac86.tar.bz2
android_packages_apps_Trebuchet-747f2b66e8a4b641a39b51735b92c4efb801ac86.zip
am fdc8eb61: Merge "Fixing NPE in recycler view scroll bar." into ub-launcher3-burnaby
* commit 'fdc8eb61a417af22dac8bc97dd5f19f728c80060': Fixing NPE in recycler view scroll bar.
Diffstat (limited to 'src/com/android/launcher3/widget')
-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 3dcb33268..884bdc418 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;
}