Skip to content

Commit

Permalink
fix: initalize the connectors map to avoid nil pointer exception (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul2393 committed Jul 31, 2023
1 parent 580fff3 commit ec69c32
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit ec69c32

Please sign in to comment.