Skip to content
This repository was archived by the owner on Oct 7, 2022. It is now read-only.
This repository was archived by the owner on Oct 7, 2022. It is now read-only.

Nil Map when unmarshalling Json #9

@victorddiniz

Description

@victorddiniz

On function JsonMessageToRecord, the msg.Value may be a JSON literal null. In that case, according to Go's documentation:

Unmarshal first handles the case of the JSON being the JSON literal null. In that case, Unmarshal sets the pointer to nil

Given that, jsonValue will be a nil map and you cannot write any value to nil map.

It would be better to handle any errors before writing any values to the map and also to check if the map is not nil, as JSON literal null is a valid input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions