summaryrefslogtreecommitdiffstats
path: root/rs
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-03-17 20:05:46 -0700
committerAndreas Gampe <agampe@google.com>2015-03-18 12:24:57 -0700
commitad555f91a0f95c6778a0e0f9a2a9cfd57dc00b6c (patch)
treec2f1f391ca88ac359966b3b1d5cd4c2a7c0ace88 /rs
parent28e6aeca3aad075ef4fd7aab08cd1ad1ff9eb555 (diff)
downloadframeworks_base-ad555f91a0f95c6778a0e0f9a2a9cfd57dc00b6c.zip
frameworks_base-ad555f91a0f95c6778a0e0f9a2a9cfd57dc00b6c.tar.gz
frameworks_base-ad555f91a0f95c6778a0e0f9a2a9cfd57dc00b6c.tar.bz2
Frameworks/base: Fix potential NPE in Script
Bug: 19797138 Change-Id: I5cd9394bd2c0f7c044c1f2f24665384fa797cd97
Diffstat (limited to 'rs')
-rw-r--r--rs/java/android/renderscript/Script.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/rs/java/android/renderscript/Script.java b/rs/java/android/renderscript/Script.java
index 83aeedd..65056ac 100644
--- a/rs/java/android/renderscript/Script.java
+++ b/rs/java/android/renderscript/Script.java
@@ -251,9 +251,14 @@ public class Script extends BaseObj {
"At least one of ain or aout is required to be non-null.");
}
- long[] in_ids = new long[ains.length];
- for (int index = 0; index < ains.length; ++index) {
- in_ids[index] = ains[index].getID(mRS);
+ long[] in_ids;
+ if (ains != null) {
+ in_ids = new long[ains.length];
+ for (int index = 0; index < ains.length; ++index) {
+ in_ids[index] = ains[index].getID(mRS);
+ }
+ } else {
+ in_ids = null;
}
long out_id = 0;