From 360328b8c6f554b0ee68df4a5557967122e35a10 Mon Sep 17 00:00:00 2001 From: ikawaha Date: Mon, 2 Mar 2015 23:18:27 +0900 Subject: [PATCH] Fixed a bug that panic occurs when the value is null --- postgres.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/postgres.go b/postgres.go index 994ed9b8..496ee626 100644 --- a/postgres.go +++ b/postgres.go @@ -106,7 +106,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() }