Change-Id: I6afebd7c0a92edb25e3658e7f860244d7457c852
@Override
public View getLastItem() {
int lastRank = getShortcutsAndWidgets().getChildCount() - 1;
- return getShortcutsAndWidgets().getChildAt(lastRank % getCountX(), lastRank / getCountX());
+ // count can be zero if the folder is not yet laid out.
+ int count = getCountX();
+ if (count > 0) {
+ return getShortcutsAndWidgets().getChildAt(lastRank % count, lastRank / count);
+ } else {
+ return getShortcutsAndWidgets().getChildAt(lastRank);
+ }
}
@Override