Don't panic when field value is invalid
@@ -171,6 +171,7 @@ func Stringify(object interface{}) string {
scope := gorm.Scope{Value: object}
for _, column := range []string{"Name", "Title", "Code"} {
if field, ok := scope.FieldByName(column); ok {
+ if field.Field.IsValid() {
result := field.Field.Interface()
if valuer, ok := result.(driver.Valuer); ok {
if result, err := valuer.Value(); err == nil {
@@ -180,6 +181,7 @@ func Stringify(object interface{}) string {
return fmt.Sprint(result)
}
}
+ }
if scope.PrimaryField() != nil {
if scope.PrimaryKeyZero() {
