godotengine / godotengine/godot
Error `Cannot get class ''. Parameter "obj" is null.` under specific conditions
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in: v4.3.stable.official [77dcf97d8]
### System information
Windows 10 and Ubuntu 20.04.6 - Compatibility renderer
### Issue description
I encountered this bug while making [my game](https://github.com/OgGhostJelly/Zombie-BurgerZ) and [this](https://github.com/OgGhostJelly/Zombie-BurgerZ/commit/e6c37a912ecf8d6a1ca74b40c4157c82377bdbc9#diff-76682f3289631b5dee833f7ddebba25fa0541aea3fffca458c8c925fa528e347) is the commit that started causing the errors, more specifically it seems the changes to `player.gd` and `gun.gd` are what caused it. If you try to select the smg in the shop it will segfault. The bug is now fixed in the later commits, I fixed it by replacing `preload` with `load` but I'm unsure why that worked.
### Steps to reproduce
- Download the attached Godot project
- Run it normally and see how there are no errors
- Export it into the .exports folder inside the project, it MUST be exported into that folder or else the bug won't appear. (not sure why, maybe something to do with the filename having a special character in it)
- Run the project in the terminal and see how there are now errors appearing in the exported version
### Minimal reproduction project (MRP)
The MRP is my game with all the code unrelated to the bug stripped away
[bug.zip](https://github.com/user-attachments/files/18045954/bug.zip)
Contributor guide
Research direction
Start by running the attached bug.zip project using the stated export path, then compare the behavior around player.gd, gun.gd, preload, and load. Reproduce the exported-project errors and SMG shop crash, and confirm that the underlying issue is resolved without relying on the reported workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100