77e1f26d by astaxie

Merge pull request #728 from nizsheanez/null_pointer_panic_improve

[orm] improve null pointer panic message
2 parents 2820f630 df8c73b2
1 .idea
1 .DS_Store 2 .DS_Store
2 *.swp 3 *.swp
3 *.swo 4 *.swo
......
...@@ -131,6 +131,9 @@ func getFieldType(val reflect.Value) (ft int, err error) { ...@@ -131,6 +131,9 @@ func getFieldType(val reflect.Value) (ft int, err error) {
131 case reflect.String: 131 case reflect.String:
132 ft = TypeCharField 132 ft = TypeCharField
133 default: 133 default:
134 if elm == nil {
135 panic(fmt.Errorf("%s is nil pointer, may be miss setting tag", val))
136 }
134 switch elm.Interface().(type) { 137 switch elm.Interface().(type) {
135 case sql.NullInt64: 138 case sql.NullInt64:
136 ft = TypeBigIntegerField 139 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!