[golang] Fix Null pointer exception in toVarName (#377)

This commit is contained in:
sunn 2018-07-03 05:58:05 +02:00 committed by Jérémie Bresson
parent 001f5ae50d
commit 83e14a7b44

View File

@ -144,8 +144,9 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
@Override
public String toVarName(String name) {
// replace - with _ e.g. created-at => created_at
name = sanitizeName(name.replaceAll("-", "_"));
name = sanitizeName(name);
// if it's all uppper case, do nothing
if (name.matches("^[A-Z_]*$"))