summaryrefslogtreecommitdiffstats
path: root/rs/java
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2015-03-26 22:10:46 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-03-26 22:10:47 +0000
commit22580b83f18b572707ea47f99cb9016f067b89f8 (patch)
tree242f88dcac1e414ec0d74d6301565fb1a17df090 /rs/java
parent727cac07cc823f4a21be420aa33da6369b390c54 (diff)
parentae5be38ebbfdfa3a6ff18a5ced00e57adefd7348 (diff)
downloadframeworks_base-22580b83f18b572707ea47f99cb9016f067b89f8.zip
frameworks_base-22580b83f18b572707ea47f99cb9016f067b89f8.tar.gz
frameworks_base-22580b83f18b572707ea47f99cb9016f067b89f8.tar.bz2
Merge "Fix potential npe"
Diffstat (limited to 'rs/java')
-rw-r--r--rs/java/android/renderscript/Mesh.java6
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;