Skip to content

Commit

Permalink
Fixed: Generate null/undefined assertion in fromObject if actually NO…
Browse files Browse the repository at this point in the history
…T an enum, see #620
  • Loading branch information
dcodeIO committed Jan 12, 2017
1 parent 079388c commit 5bca18f
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 19 deletions.
20 changes: 17 additions & 3 deletions dist/noparse/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/noparse/protobuf.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/noparse/protobuf.min.js

Large diffs are not rendered by default.

Binary file modified dist/noparse/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/noparse/protobuf.min.js.map

Large diffs are not rendered by default.

21 changes: 17 additions & 4 deletions dist/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/protobuf.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/protobuf.min.js

Large diffs are not rendered by default.

Binary file modified dist/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/protobuf.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/runtime/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/runtime/protobuf.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/runtime/protobuf.min.js.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions src/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ converter.fromObject = function fromObject(mtype) {

// Non-repeated fields
} else {
if (field.resolvedType instanceof Enum) gen // no need to test for null/undefined if an enum (uses switch)
if (!(field.resolvedType instanceof Enum)) gen // no need to test for null/undefined if an enum (uses switch)
("if(d%s!==undefined&&d%s!==null){", prop, prop);
genConvertValue_fromObject(gen, field, i, prop);
if (field.resolvedType instanceof Enum) gen
if (!(field.resolvedType instanceof Enum)) gen
("}");
}
}
Expand Down

0 comments on commit 5bca18f

Please sign in to comment.