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

Fix error with toolgun when first opening the spawnmenu #10

Open
Guthen opened this issue Oct 6, 2024 · 0 comments
Open

Fix error with toolgun when first opening the spawnmenu #10

Guthen opened this issue Oct 6, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Guthen
Copy link
Owner

Guthen commented Oct 6, 2024

Error log

Clientside:

[guthscpbase-master] addons/guthscpbase-master/lua/weapons/gmod_tool/stools/guthscp_zone_configurator.lua:125: attempt to index local 'tool' (a nil value)
1. ControlPanelBuildFunction - addons/guthscpbase-master/lua/weapons/gmod_tool/stools/guthscp_zone_configurator.lua:125
2. FillViaTable - gamemodes/sandbox/gamemode/spawnmenu/controlpanel.lua:126
3. ActivateTool - lua/includes/modules/spawnmenu.lua:116
4. Open - gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua:130
5. Run - gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua:265
6. unknown - gamemodes/base/gamemode/cl_spawnmenu.lua:11
7. unknown - lua/includes/modules/concommand.lua:54

Developper Hints

I believe this happens when first opening the spawnmenu with the tool selected. For some reason (either the tool weapon isn't stored in the player's inventory or the tool mode is wrong), Player:GetTool returns a nil value. Just adding a default value if tool is invalid should fix the error. If it's inconvenient, we can replace the code by directly retrieving the value of the zone_id convar without passing through the tool class.

@Guthen Guthen added the bug Something isn't working label Oct 6, 2024
@Guthen Guthen self-assigned this Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant