Skip to content

Commit

Permalink
Merge pull request #111 from imiskolee/master
Browse files Browse the repository at this point in the history
1. fix bug: #110
  • Loading branch information
vektah committed May 12, 2018
2 parents 3990eac + e38cb49 commit e1fd79f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion codegen/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ func (t Type) unmarshal(result, raw string, remainingMods []string, depth int) s
var rawIf = "rawIf" + strconv.Itoa(depth)
var index = "idx" + strconv.Itoa(depth)

return tpl(`{{.rawSlice}} := {{.raw}}.([]interface{})
return tpl(`var {{.rawSlice}} []interface{}
if {{.raw}} != nil {
{{.rawSlice}} = {{.raw}}.([]interface{})
}
{{.result}} = make({{.type}}, len({{.rawSlice}}))
for {{.index}} := range {{.rawSlice}} {
{{ .next -}}
Expand Down
10 changes: 8 additions & 2 deletions example/dataloader/generated.go

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

0 comments on commit e1fd79f

Please sign in to comment.