Update generator.go

fix nil panic
Merge pull request #10 from ngaut/master

fix nil panic in generator.go