fixing nil pointer reference

This commit is contained in:
jackspirou 2015-11-20 19:16:28 -06:00
parent 5a516ac3f7
commit 5a591e800a
1 changed files with 3 additions and 2 deletions

View File

@ -52,8 +52,9 @@ func main() {
var buf *bytes.Buffer
var reqBytes []byte
if len(vargs.Template) == 0 {
json.NewEncoder(buf).Encode(&data)
b := buf.Bytes()
var t bytes.Buffer
json.NewEncoder(&t).Encode(&data)
b := t.Bytes()
buf = bytes.NewBuffer(b)
reqBytes = b
} else {