Skip to content

Fix: Initialize(): nil ptr deref with not handled err#4

Merged
jinzhu merged 1 commit intogo-gorm:masterfrom
Jackneill:fix_nil_ptr_deref
Aug 5, 2020
Merged

Fix: Initialize(): nil ptr deref with not handled err#4
jinzhu merged 1 commit intogo-gorm:masterfrom
Jackneill:fix_nil_ptr_deref

Conversation

@Jackneill
Copy link
Copy Markdown

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x16e87b1]

goroutine 1 [running]:
gorm.io/driver/postgres.Dialector.Initialize(0xc00026d5e0, 0xc00058ec60, 0x1a6d660, 0xc00058ecc0)
        /home/user/.go/pkg/mod/gorm.io/driver/postgres@v0.2.6/postgres.go:63 +0x171
gorm.io/gorm.Open(0x1d0c800, 0xc000693168, 0xc0000a8d00, 0x0, 0x270dac0, 0x7fc2b93a2e98)
        /home/user/.go/pkg/mod/gorm.io/gorm@v0.2.24/gorm.go:108 +0x7d6
gitlab.com/org/app/user/internal/db/user.New(0xc000387f60, 0xc000387f60, 0x0, 0x193c860)
        /home/user/ws/org/user/internal/db/user/user.go:29 +0xdb
gitlab.com/org/app/internal/handler/user.NewHandler(0xc000693160, 0x0, 0x0, 0x0)
        /home/user/ws/org/user/internal/handler/user/handler.go:31 +0x11b
main.main()
        /home/user/ws/org/user/cmd/user/main.go:23 +0xff

User Case Description

Fix Panic(nil ptr deref/non-handled err).

@jinzhu jinzhu merged commit 52c9374 into go-gorm:master Aug 5, 2020
@Jackneill Jackneill deleted the fix_nil_ptr_deref branch August 5, 2020 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants