diff options
Diffstat (limited to 'carousel/java')
-rw-r--r-- | carousel/java/com/android/ex/carousel/CarouselRS.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/carousel/java/com/android/ex/carousel/CarouselRS.java b/carousel/java/com/android/ex/carousel/CarouselRS.java index e60fcc7..3de1037 100644 --- a/carousel/java/com/android/ex/carousel/CarouselRS.java +++ b/carousel/java/com/android/ex/carousel/CarouselRS.java @@ -473,11 +473,10 @@ public class CarouselRS { // Because RenderScript can't have allocations with 0 dimensions, we always create // an allocation of at least one card. This relies on invoke_createCards() to keep // track of when the allocation is not valid. - if (mCards != null) { + if (mCards != null && count > 0) { // resize the array int oldSize = mCards.getAllocation().getType().getX(); - int newSize = count > 0 ? count : 1; - mCards.resize(newSize); + mCards.resize(count); mScript.invoke_createCards(oldSize, count); } else { // create array from scratch |