Skip to content

Fix panic on NullTime.UnmarshalJSON#73

Open
khoden wants to merge 1 commit intomgutz:v1from
khoden:patch-1
Open

Fix panic on NullTime.UnmarshalJSON#73
khoden wants to merge 1 commit intomgutz:v1from
khoden:patch-1

Conversation

@khoden
Copy link
Copy Markdown

@khoden khoden commented Aug 3, 2017

type WithDate struct {
	Time dat.NullTime `json:"time"`
}

func TestParseNumberAsDate(t *testing.T) {
	data := `{"time":5}`
	result := &WithDate{}
	json.Unmarshal([]byte(data), result) // PANIC!
}

```json
type WithDate struct {
	Time dat.NullTime `json:"time"`
}

func TestParseNumberAsDate(t *testing.T) {
	data := `{"time":5}`
	result := &WithDate{}
	json.Unmarshal([]byte(data), result) // PANIC!
}
```
Copy link
Copy Markdown

@C-Pro C-Pro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems legit

@JelteF
Copy link
Copy Markdown

JelteF commented Aug 15, 2017

This test should probably be added to the actual tests as well.

@khoden
Copy link
Copy Markdown
Author

khoden commented Aug 25, 2017

Please, accept

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants