X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fcom%2Fandroid%2Flauncher3%2Fwidget%2FWidgetsRecyclerView.java;h=884bdc418171826bedfaf84cbab9754b9666894c;hb=23c8f48f4334b0ac0752b320dad2c1fc5ef095f3;hp=3dcb33268f09941659a92719db691cd5c5fc7b56;hpb=a79b18ad36ca9025ac4862c492260a656f61c7cf;p=android-x86%2Fpackages-apps-Launcher3.git 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; }