From 5e0a78c18dede2357407a9b93273c5496ea6d8f2 Mon Sep 17 00:00:00 2001 From: Gogsi <1671056+Gogsi@users.noreply.github.com> Date: Sun, 27 Sep 2026 00:37:30 +0300 Subject: [PATCH] fix: Guard SetEntityDrawOutline behind a DoesEntityExist check In FiveM for GTAV Enhanced, calling SetEntityDrawOutline on an invalid entity throws an error and ends execution of the function, breaking the decoration customization. --- client/decorating.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/client/decorating.lua b/client/decorating.lua index 7a05ab5..6875afc 100644 --- a/client/decorating.lua +++ b/client/decorating.lua @@ -100,10 +100,13 @@ function ToggleDecorating() if cursorMode then local entity = SelectEntityAtCursor((1 << 5), true) if entity ~= last then - if lib.table.contains(DecorationObjects, entity) then + if lib.table.contains(DecorationObjects, entity) and DoesEntityExist(entity) then SetEntityDrawOutline(entity, true) end - SetEntityDrawOutline(last, false) + + if DoesEntityExist(last) then + SetEntityDrawOutline(last, false) + end last = entity end if IsDisabledControlJustReleased(0, 24) and previewObject ~= entity and entity ~= 0 then @@ -122,7 +125,9 @@ function ToggleDecorating() DeleteEntity(previewObject) end end - SetEntityDrawOutline(last, false) + if DoesEntityExist(last) then + SetEntityDrawOutline(last, false) + end ToggleDecorating() end if IsDisabledControlJustReleased(0, 38) then @@ -134,7 +139,9 @@ function ToggleDecorating() if cursorMode then EnterCursorMode() else - SetEntityDrawOutline(last, false) + if DoesEntityExist(last) then + SetEntityDrawOutline(last, false) + end LeaveCursorMode() end end