From 282d81500c1b19176500eadf652b98272572dc33 Mon Sep 17 00:00:00 2001 From: Luke Date: Fri, 15 Apr 2022 11:27:08 +0200 Subject: [PATCH] fix(client/context): Throw error when context id doesn't exist Opening a context menu before registering it would previously result in the script completely erroring out and having stuck nui focus --- resource/interface/client/context.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/resource/interface/client/context.lua b/resource/interface/client/context.lua index 28f372e..03910ff 100644 --- a/resource/interface/client/context.lua +++ b/resource/interface/client/context.lua @@ -2,6 +2,7 @@ local contextMenus = {} local openContextMenu = nil function lib.showContext(id) + if not contextMenus[id] then return error('No context menu of such id found.') end local data = contextMenus[id] openContextMenu = id SetNuiFocus(true, true)