2
0

Fix crash with pointer to nil struct

This commit is contained in:
Jack Christensen
2022-03-22 19:20:22 -05:00
parent 9f23ed84ba
commit 5ca048ed2d
2 changed files with 15 additions and 1 deletions
+9
View File
@@ -175,6 +175,15 @@ func TestTypeMapScanUnregisteredOIDToCustomType(t *testing.T) {
assert.Nil(t, pCt)
}
func TestTypeMapScanPointerToNilStructDoesNotCrash(t *testing.T) {
m := pgtype.NewMap()
type myStruct struct{}
var p *myStruct
err := m.Scan(0, pgx.TextFormatCode, []byte("(foo,bar)"), &p)
require.NotNil(t, err)
}
func TestTypeMapScanUnknownOIDTextFormat(t *testing.T) {
m := pgtype.NewMap()