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
This commit is contained in:
Andreas Gampe
2015-03-15 15:57:30 -07:00
parent 30fcd2aa8a
commit c8ddcddd13

View File

@ -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);