From 9047d21ec52dadc762688a8534dff03e91f2260a Mon Sep 17 00:00:00 2001 From: slene Date: Thu, 8 Aug 2013 22:15:27 +0800 Subject: [PATCH] orm fix, def a string in model but use int in db may cause nil pointer error --- orm/db.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/orm/db.go b/orm/db.go index 190b0c44..8e23e386 100644 --- a/orm/db.go +++ b/orm/db.go @@ -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) {