From ec69c321262631c3cdc4369c01ed8abc6932792f Mon Sep 17 00:00:00 2001 From: rahul2393 Date: Mon, 31 Jul 2023 15:17:19 +0530 Subject: [PATCH] fix: initalize the connectors map to avoid nil pointer exception (#158) --- driver.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/driver.go b/driver.go index 8611160..3e75f60 100644 --- a/driver.go +++ b/driver.go @@ -177,6 +177,9 @@ type connector struct { func newConnector(d *Driver, dsn string) (*connector, error) { d.mu.Lock() defer d.mu.Unlock() + if d.connectors == nil { + d.connectors = make(map[string]*connector) + } if c, ok := d.connectors[dsn]; ok { return c, nil }