forked from mirror/gorm
Merge pull request #396 from ikawaha/fix/hstore_20150302
Fixed a bug that panic occurs when the value is null
This commit is contained in:
commit
3740a3beaa
|
@ -112,7 +112,12 @@ func (h Hstore) Value() (driver.Value, error) {
|
|||
}
|
||||
|
||||
for key, value := range h {
|
||||
hstore.Map[key] = sql.NullString{String: *value, Valid: true}
|
||||
var s sql.NullString
|
||||
if value != nil {
|
||||
s.String = *value
|
||||
s.Valid = true
|
||||
}
|
||||
hstore.Map[key] = s
|
||||
}
|
||||
return hstore.Value()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue