summaryrefslogtreecommitdiffstats
path: root/rs/java
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-03-15 15:57:30 -0700
committerAndreas Gampe <agampe@google.com>2015-03-15 15:57:30 -0700
commitc8ddcddd13bda93758295713a29fa4b924451ff6 (patch)
treef523f10809a8a89854d0f0843b0f09d344b17803 /rs/java
parent30fcd2aa8a87ca97e1d6dbc3203c3a485a56dac9 (diff)
downloadframeworks_base-c8ddcddd13bda93758295713a29fa4b924451ff6.zip
frameworks_base-c8ddcddd13bda93758295713a29fa4b924451ff6.tar.gz
frameworks_base-c8ddcddd13bda93758295713a29fa4b924451ff6.tar.bz2
Frameworks/base: Check before foreach in Script
According to the if below, ains == null is potentially valid. But the foreach loop would throw a NullPointerException. Change-Id: I4460fb1357eaa3abfe0ab9a21effb608f474ab51
Diffstat (limited to 'rs/java')
-rw-r--r--rs/java/android/renderscript/Script.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/rs/java/android/renderscript/Script.java b/rs/java/android/renderscript/Script.java
index d352130..83aeedd 100644
--- a/rs/java/android/renderscript/Script.java
+++ b/rs/java/android/renderscript/Script.java
@@ -239,8 +239,10 @@ public class Script extends BaseObj {
FieldPacker v, LaunchOptions sc) {
// TODO: Is this necessary if nScriptForEach calls validate as well?
mRS.validate();
- for (Allocation ain : ains) {
- mRS.validateObject(ain);
+ if (ains != null) {
+ for (Allocation ain : ains) {
+ mRS.validateObject(ain);
+ }
}
mRS.validateObject(aout);