Skip to content

Instantly share code, notes, and snippets.

@luciofm
Created July 28, 2014 13:12
Show Gist options
  • Save luciofm/15a359d09859601040d9 to your computer and use it in GitHub Desktop.
Save luciofm/15a359d09859601040d9 to your computer and use it in GitHub Desktop.
diff --git a/library/src/main/java/org/lucasr/twowayview/TWSpannableGridLayoutManager.java b/library/src/main/java/org/lucasr/twowayview/TWSpannableGridLayoutManager.java
index e631060..d6956ff 100644
--- a/library/src/main/java/org/lucasr/twowayview/TWSpannableGridLayoutManager.java
+++ b/library/src/main/java/org/lucasr/twowayview/TWSpannableGridLayoutManager.java
@@ -218,6 +218,8 @@ public class TWSpannableGridLayoutManager extends TWGridLayoutManager {
int childCount = 0, i = 0;
while (i < itemCount && i < laneCount) {
SpannableItemEntry entry = (SpannableItemEntry) getItemEntryForPosition(i);
+ if (entry == null)
+ break;
i += (isVertical ? entry.colSpan : entry.rowSpan);
childCount++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment