df8c73b2 by Alexey Sharov

improve null pointer panic message

1 parent cec151fd
1 .idea
1 .DS_Store 2 .DS_Store
2 *.swp 3 *.swp
3 *.swo 4 *.swo
......
...@@ -132,6 +132,9 @@ func getFieldType(val reflect.Value) (ft int, err error) { ...@@ -132,6 +132,9 @@ func getFieldType(val reflect.Value) (ft int, err error) {
132 case reflect.String: 132 case reflect.String:
133 ft = TypeCharField 133 ft = TypeCharField
134 default: 134 default:
135 if elm == nil {
136 panic(fmt.Errorf("%s is nil pointer, may be miss setting tag", val))
137 }
135 switch elm.Interface().(type) { 138 switch elm.Interface().(type) {
136 case sql.NullInt64: 139 case sql.NullInt64:
137 ft = TypeBigIntegerField 140 ft = TypeBigIntegerField
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!