Skip to content

Commit 9e7c1f5

Browse files
committed
decoder#decoder adds a null check before assigning back to the message
This is necessary because the TypeScript type is Message|undefined and null is not a valid value.
1 parent 674896f commit 9e7c1f5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/decoder.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ function decoder(mtype) {
7474
if (types.long[field.keyType] !== undefined) gen
7575
("%s[typeof k===\"object\"?util.longToHash(k):k]=value", ref);
7676
else gen
77-
("%s[k]=value", ref);
77+
("if (value != null)")
78+
("%s[k]=value", ref);
7879

7980
// Repeated fields
8081
} else if (field.repeated) { gen

0 commit comments

Comments
 (0)