diff options
author | Jason Sams <jsams@google.com> | 2015-03-26 14:47:17 -0700 |
---|---|---|
committer | Jason Sams <jsams@google.com> | 2015-03-26 14:47:17 -0700 |
commit | ae5be38ebbfdfa3a6ff18a5ced00e57adefd7348 (patch) | |
tree | 0dd803865f2a754068a60a9895c0482c5d9b1ced /rs | |
parent | 5fc9b336ebb6fc224b3e77af388024dea029fbb3 (diff) | |
download | frameworks_base-ae5be38ebbfdfa3a6ff18a5ced00e57adefd7348.zip frameworks_base-ae5be38ebbfdfa3a6ff18a5ced00e57adefd7348.tar.gz frameworks_base-ae5be38ebbfdfa3a6ff18a5ced00e57adefd7348.tar.bz2 |
Fix potential npe
bug 19805515
Change-Id: Id36b145d3ce1c81311e88f5cdd2441880e98f737
Diffstat (limited to 'rs')
-rw-r--r-- | rs/java/android/renderscript/Mesh.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rs/java/android/renderscript/Mesh.java b/rs/java/android/renderscript/Mesh.java index 5b4cadb..13c8e1c 100644 --- a/rs/java/android/renderscript/Mesh.java +++ b/rs/java/android/renderscript/Mesh.java @@ -363,6 +363,9 @@ public class Mesh extends BaseObj { alloc = Allocation.createTyped(mRS, entry.t, mUsage); } else if(entry.e != null) { alloc = Allocation.createSized(mRS, entry.e, entry.size, mUsage); + } else { + // Should never happen because the builder will always set one + throw new IllegalStateException("Builder corrupt, no valid element in entry."); } vertexBuffers[ct] = alloc; vtx[ct] = alloc.getID(mRS); @@ -375,6 +378,9 @@ public class Mesh extends BaseObj { alloc = Allocation.createTyped(mRS, entry.t, mUsage); } else if(entry.e != null) { alloc = Allocation.createSized(mRS, entry.e, entry.size, mUsage); + } else { + // Should never happen because the builder will always set one + throw new IllegalStateException("Builder corrupt, no valid element in entry."); } long allocID = (alloc == null) ? 0 : alloc.getID(mRS); indexBuffers[ct] = alloc; |