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:get_properties() may return nothing inside on_joinplayer #12350

Closed
appgurueu opened this issue May 19, 2022 · 4 comments
Closed

player:get_properties() may return nothing inside on_joinplayer #12350

appgurueu opened this issue May 19, 2022 · 4 comments
Labels
@ Script API Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible

Comments

@appgurueu
Copy link
Contributor

Minetest version
5.5
Summary

See this bug report. The line in question contains just local mesh = player:get_properties().mesh and sometimes triggers an "attempt to index a nil value" error when called from inside on joinplayer.

Steps to reproduce
minetest.register_on_joinplayer(function(player) local _ = player:get_properties().something end)

this seems to be a Heisenbug so you may have to try various connection scenarios which may invalidate the player (properties)

Possible fixes
  1. Code-wise: Returning an empty table (may lead to follow-up errors as some properties may be assumed to be non-nil)
  2. Documentation-wise: Document when get_properties() returns nothing (currently the docs claim it returns an object property table, which is not always the case), which seems to be the case (1) if the objref is invalid (player left?) or (2) if m_prop is null (how is this even possible?)
@appgurueu appgurueu added the Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible label May 19, 2022
@SmallJoker
Copy link
Member

Does #12189 help in this regard?

@appgurueu
Copy link
Contributor Author

appgurueu commented May 21, 2022

It may, but I can't say for sure. How would I trigger such an invalid objref inside on_joinplayer? The crash in character_anim doesn't involve get_connected_players BTW...

@sfan5
Copy link
Member

sfan5 commented May 27, 2022

Without a reliable reproducer this doesn't seem fixable...

@Zughy
Copy link
Member

Zughy commented Jun 21, 2022

I've run a devtest world 15 times and a MTG world 10 times, trying to perform different actions: no crash experienced. I invite to open another issue when more information will be available to trigger this crash (if still exists). Closing here

@Zughy Zughy closed this as completed Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@ Script API Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible
Projects
None yet
Development

No branches or pull requests

4 participants