Skip to content

Exception encoding nulled long #590

@robin-anil

Description

@robin-anil

When encoding a long field set to null (which is typical of a JSON object), instead of the field being ignored the code throws an exception. I don't see a reason not to support the old behavior. Null or undefined override on a nulled field should ignore it from being encoded on the byte stream.

util.longNe = function longNe(val, lo, hi) {
    if (typeof val === "object") // Long-like, null is invalid and throws
        return val.low !== lo || val.high !== hi;
    var bits = util.LongBits.from(val);
    return bits.lo !== lo || bits.hi !== hi;
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions