am e6857531: am f3e581c9: Merge "Frameworks/base: Check before foreach in Script"

* commit 'e685753136ee8e88212ad95b24284a153c86a0c1':
  Frameworks/base: Check before foreach in Script
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 @@
                            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);