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

panics for nil pointer dereferences cannot be recovered #3859

Closed
thehowl opened this issue Feb 28, 2025 · 1 comment
Closed

panics for nil pointer dereferences cannot be recovered #3859

thehowl opened this issue Feb 28, 2025 · 1 comment
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@thehowl
Copy link
Member

thehowl commented Feb 28, 2025

Gno currently doesn't allow using recover() when a nil pointer has been referenced. This came up with adapting fmt (#3847), where I cannot show <nil> for a case like the following:

func main() {
	v := (*time.Time)(nil)
	fmt.Println(v)
}

v.String() panics because String() expects a non-pointer receiver. The fmt code should be able to recover() from this panic, and show a "<nil>" instead, however this is not the case.

@thehowl
Copy link
Member Author

thehowl commented Feb 28, 2025

Sorry, this actually works, my mistake!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Development

No branches or pull requests

1 participant