1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-02 18:03:27 +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
}
case fieldType == TypeCharField || fieldType == TypeTextField:
s := str.String()
if str == nil {
s = ToStr(val)
value = ToStr(val)
} else {
value = str.String()
}
value = s
case fieldType == TypeDateField || fieldType == TypeDateTimeField:
if str == nil {
switch v := val.(type) {