1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 22:01:29 +00:00

orm fix, def a string in model but use int in db may cause nil pointer error

This commit is contained in:
slene 2013-08-08 22:15:27 +08:00
parent 74a95f6cbf
commit 9047d21ec5

View File

@ -1070,11 +1070,11 @@ setValue:
value = b value = b
} }
case fieldType == TypeCharField || fieldType == TypeTextField: case fieldType == TypeCharField || fieldType == TypeTextField:
s := str.String()
if str == nil { if str == nil {
s = ToStr(val) value = ToStr(val)
} else {
value = str.String()
} }
value = s
case fieldType == TypeDateField || fieldType == TypeDateTimeField: case fieldType == TypeDateField || fieldType == TypeDateTimeField:
if str == nil { if str == nil {
switch v := val.(type) { switch v := val.(type) {