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

player/player.go: fix PickBlock nil pointer #933

Closed
wants to merge 1 commit into from

Conversation

Dasciam
Copy link
Contributor

@Dasciam Dasciam commented Nov 15, 2024

No description provided.

@@ -1888,7 +1888,10 @@ func (p *Player) PickBlock(pos cube.Pos) {
if pi, ok := b.(block.Pickable); ok {
pickedItem = pi.Pick()
} else if i, ok := b.(world.Item); ok {
it, _ := world.ItemByName(i.EncodeItem())
it, ok := world.ItemByName(i.EncodeItem())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround. EncodeItem should always be returning a valid registered item id & meta.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swear to you, it crashed my server. For some reason it doesn't

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like an issue to debug. Could you find out when that happens?

@DaPigGuy DaPigGuy closed this Nov 17, 2024
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.

3 participants