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

[Bug] "attempt to index nil with 'item'" #61

Open
JimmyDeemo opened this issue Nov 29, 2022 · 0 comments
Open

[Bug] "attempt to index nil with 'item'" #61

JimmyDeemo opened this issue Nov 29, 2022 · 0 comments

Comments

@JimmyDeemo
Copy link

Getting this error on stopping the game in Studio;

16:39:30.400  ReplicatedStorage.Modules.Zone.ZoneController.Tracker:135: attempt to index nil with 'item'  -  Server
16:39:30.400  Stack Begin  -  Studio
16:39:30.400  Script 'ReplicatedStorage.Modules.Zone.ZoneController.Tracker', Line 135  -  Studio
16:39:30.400  Script 'ReplicatedStorage.Modules.Zone.Signal', Line 37 - function acquireRunnerThreadAndCallEventHandler  -  Studio
16:39:30.400  Script 'ReplicatedStorage.Modules.Zone.Signal', Line 48 - function runEventHandlerInFreeThread  -  Studio
16:39:30.400  Stack End  -  Studio

I believe it is linked to the fact that Zone:untrackItem cleans up itemDetail and then calls Fire on Tracker.itemRemoved:

function Zone:untrackItem(instance)
	local itemDetail = self.trackedItems[instance]
	if itemDetail then
		itemDetail.janitor:destroy()
	end
	self.trackedItems[instance] = nil

	local Tracker = require(trackerModule)
	Tracker.itemRemoved:Fire(itemDetail)
end

This uses .item in the handler, which has been cleaned up:

Tracker.itemRemoved:Connect(function(itemDetail)
	self.exitDetections[itemDetail.item] = nil
	updateItem(itemDetail, nil)
end)
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

No branches or pull requests

1 participant