Index: mojo/public/cpp/bindings/lib/array_serialization.h |
diff --git a/mojo/public/cpp/bindings/lib/array_serialization.h b/mojo/public/cpp/bindings/lib/array_serialization.h |
index df53cd0db3b9ad6034bf9da34a0701dfc40e8a68..492de788b4530f4997101b8772cd864958e1845b 100644 |
--- a/mojo/public/cpp/bindings/lib/array_serialization.h |
+++ b/mojo/public/cpp/bindings/lib/array_serialization.h |
@@ -227,10 +227,12 @@ inline void SerializeArray_(Array<E> input, internal::Buffer* buf, |
internal::Array_Data<F>* result = |
internal::Array_Data<F>::New(input.size(), buf); |
- internal::ArraySerializer<E, F>::template SerializeElements< |
- ValidateParams::element_is_nullable, |
- typename ValidateParams::ElementValidateParams>( |
- internal::Forward(input), buf, result); |
+ if (result) { |
+ internal::ArraySerializer<E, F>::template SerializeElements< |
+ ValidateParams::element_is_nullable, |
+ typename ValidateParams::ElementValidateParams>( |
+ internal::Forward(input), buf, result); |
+ } |
*output = result; |
} else { |
*output = NULL; |