WireCmd: error out if "self" is null.
BUG=dawn:34
Change-Id: Ic77a6a1b2145ad9572abd6e2f3cd422d8c87f3eb
Reviewed-on: https://dawn-review.googlesource.com/c/2301
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/generator/templates/dawn_wire/WireCmd.cpp b/generator/templates/dawn_wire/WireCmd.cpp
index d9d2f4c..a72c9f4 100644
--- a/generator/templates/dawn_wire/WireCmd.cpp
+++ b/generator/templates/dawn_wire/WireCmd.cpp
@@ -211,6 +211,14 @@
//* guarantees they are filled even if there is an ID for an error object for the
//* Maybe monad mechanism.
DESERIALIZE_TRY(resolver.GetFromId(record->selfId, &record->self));
+
+ //* The object resolver returns a success even if the object is null because the
+ //* frontend is reponsible to validate that (null objects sometimes have special
+ //* meanings). However it is never valid to call a method on a null object so we
+ //* can error out in that case.
+ if (record->self == nullptr) {
+ return DeserializeResult::FatalError;
+ }
{% endif %}
{% if is_struct and as_struct.extensible %}