protobuf.js version: 6.5.0
I'm trying to send an object that's converted from a message (via toObject({defaults: true})) back to server, but I got something like:
Uncaught TypeError: Cannot read property 'freq' of null
The messages looks like
message Foo {
Bar bar = 1; // sometimes not provided by server
}
message Bar {
string freq = 1;
}
and the js
// bar is not provided by server
var foo = Foo.decode(...).toObejct({defaults: true}) // {bar: null}
....some time later
var message = Foo.encode(foo) // Uncaught TypeError: Cannot read property 'freq' of null
It was working perfectly fine before 6.5.0. Seems to be caused by the generated code only checking for undefined but not null.

So maybe we can make toObject use undefined instead of null? Or let the generated code check for both null and undefined?
protobuf.js version: 6.5.0
I'm trying to send an object that's converted from a message (via
toObject({defaults: true})) back to server, but I got something like:The messages looks like
and the js
It was working perfectly fine before 6.5.0. Seems to be caused by the generated code only checking for

undefinedbut notnull.So maybe we can make
toObjectuseundefinedinstead of null? Or let the generated code check for bothnullandundefined?