From 94c7fbbc243402f5c940f2ce65f01b7bcdb51401 Mon Sep 17 00:00:00 2001 From: olly Date: Thu, 16 Aug 2018 05:12:32 -0700 Subject: [PATCH] Add more information to unexpected assertion failure Issue: #4532 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=208968252 --- .../exoplayer2/upstream/DefaultAllocator.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultAllocator.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultAllocator.java index d9bd5873f0..06ca83dd93 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultAllocator.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultAllocator.java @@ -118,8 +118,18 @@ public final class DefaultAllocator implements Allocator { } for (Allocation allocation : allocations) { // Weak sanity check that the allocation probably originated from this pool. - Assertions.checkArgument(allocation.data == initialAllocationBlock - || allocation.data.length == individualAllocationSize); + if (allocation.data != initialAllocationBlock + && allocation.data.length != individualAllocationSize) { + throw new IllegalArgumentException( + "Unexpected allocation: " + + System.identityHashCode(allocation.data) + + ", " + + System.identityHashCode(initialAllocationBlock) + + ", " + + allocation.data.length + + ", " + + individualAllocationSize); + } availableAllocations[availableCount++] = allocation; } allocatedCount -= allocations.length;