- Client version: Beta
- FxServer Version: b7604
- What you expected to happen: It should not crash the whole serverside script when getting a invalid entity
- What actually happens: The serverside script crashes
- Category of bug: serverside native
Hey, I’d like to report an issue with the “NetworkGetNetworkIdFromEntity” native. It’s causing crashes when attempting to access an invalid entity, even when checking the entity with “DoesEntityExist” first. It seems that in rare cases, the entity exists when checked with DoesEntityExist but is considered invalid when checked with NetworkGetNetworkIdFromEntity.
Proposed fix: Change the native function to prevent crashing the entire server-side script when calling an invalid entity. Currently, the entire server-side script crashes with the error message: “Execution of native 000000009e35dab6 in script host failed: Tried to access invalid entity.”
Repro script (server-side), although encountering the crash is highly unlikely, because more players = more vehicles / lower wait timer = higher possibility:
CreateThread(function()
while true do
for _, vehicle in ipairs(GetAllVehicles()) do
if DoesEntityExist(vehicle) then
local netId = NetworkGetNetworkIdFromEntity(vehicle) --CAUSING SCRIPT TO CRASH
end
end
Wait(1000)
end
end)