Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrib/drivers/pgsql: panic: runtime error: invalid memory address or nil pointer dereference #3746

Closed
y1jiong opened this issue Aug 26, 2024 · 1 comment
Labels
bug It is confirmed a bug, but don't worry, we'll handle it.

Comments

@y1jiong
Copy link
Contributor

y1jiong commented Aug 26, 2024

Go version

go version go1.23.0 linux/amd64

GoFrame version

v2.7.2

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

_, err = dao.List.Ctx(ctx).
	Where(dao.List.Columns().ListName, listName).
	Data(g.Map{
		dao.List.Columns().DeletedAt: nil,
		dao.List.Columns().UpdatedAt: gtime.Now(),
	}).
	Unscoped().
	Update()

dao.List.Columns().DeletedAt: nil,

Wants

UPDATE `list`
SET `deleted_at` = NULL, `updated_at` = NOW()
WHERE `list_name` = ?;

What did you see happen?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xa8 pc=0x9debb7]
goroutine 239 [running]:
github.com/gogf/gf/contrib/drivers/pgsql/v2.(*Driver).ConvertValueForField(0xc000192010, {0x1af5358, 0xc00053c2a0}, {0xc00023d4f0, 0xb}, {0>
	github.com/gogf/gf/contrib/drivers/pgsql/[email protected]/pgsql_convert.go:23 +0x77
github.com/gogf/gf/v2/database/gdb.(*Core).ConvertDataForRecord(0xc000922000, {0x1af5358, 0xc00053c2a0}, {0x16aab00?, 0xc00053c360?}, {0xc0>
	github.com/gogf/gf/[email protected]/database/gdb/gdb_core_structure.go:66 +0x1b0
github.com/gogf/gf/v2/database/gdb.(*Core).DoUpdate(0xc000922000, {0x1af5358, 0xc00053c2a0}, {0x1af66e0, 0xc0003409a0}, {0xc0005a824a?, 0x9>
	github.com/gogf/gf/[email protected]/database/gdb/gdb_core.go:600 +0x1d2
github.com/gogf/gf/v2/database/gdb.(*HookUpdateInput).Next(0xc000922090, {0x1af5358, 0xc00053c2a0})
	github.com/gogf/gf/[email protected]/database/gdb/gdb_model_hook.go:205 +0x323
github.com/gogf/gf/v2/database/gdb.(*Model).Update(0xc000520800, {0x0, 0x0, 0x0})
	github.com/gogf/gf/[email protected]/database/gdb/gdb_model_update.go:112 +0xb25

What did you expect to see?

No panic

@y1jiong y1jiong added the bug It is confirmed a bug, but don't worry, we'll handle it. label Aug 26, 2024
@y1jiong
Copy link
Contributor Author

y1jiong commented Sep 9, 2024

Fixed in #3679

@y1jiong y1jiong closed this as completed Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It is confirmed a bug, but don't worry, we'll handle it.
Projects
None yet
Development

No branches or pull requests

2 participants
@y1jiong and others