Skip to content

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

Description

@JimmyDeemo

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions