Fixed unchecked array length crash on iOS with optional values 

This bug cashes an iOS app when optional values are not provided.