Skip to content

Commit c19358b

Browse files
fix(vet): Add a nil pointer check to prevent db/prepare panic (#2934)
resolves #2933
1 parent be6c673 commit c19358b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/cmd/vet.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,9 @@ type dbPreparer struct {
334334

335335
func (p *dbPreparer) Prepare(ctx context.Context, name, query string) error {
336336
s, err := p.db.PrepareContext(ctx, query)
337-
s.Close()
337+
if s != nil {
338+
s.Close()
339+
}
338340
return err
339341
}
340342

0 commit comments

Comments
 (0)