Fixed a bug that panic occurs when the value is null

This commit is contained in:
ikawaha 2015-03-02 23:18:27 +09:00
parent 61a878dc2d
commit 360328b8c6
1 changed files with 6 additions and 1 deletions

View File

@ -106,7 +106,12 @@ func (h Hstore) Value() (driver.Value, error) {
} }
for key, value := range h { 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() return hstore.Value()
} }