Skip to content

fix(client/context): guard against nil openContextMenu in NUI callbacks#800

Merged
thelindat merged 1 commit into
overextended:mainfrom
ASTROWwwW:fix/context-nil-guard
Jun 18, 2026
Merged

fix(client/context): guard against nil openContextMenu in NUI callbacks#800
thelindat merged 1 commit into
overextended:mainfrom
ASTROWwwW:fix/context-nil-guard

Conversation

@ASTROWwwW

Copy link
Copy Markdown
Contributor

Problem

openContext and clickContext index contextMenus[openContextMenu] without checking openContextMenu is set. If a callback fires while no menu is open (closed in between, or a stale message), this is a nil index → Lua error. In openContext, cb(1) runs after the faulty line, so the NUI promise never resolves.

Reproduce

Trigger openContext with back = true (or clickContext) while no context menu is open (e.g. after lib.hideContext()) → attempt to index a nil value.

Fix

Resolve the callback first, then dereference through a nil-checked local in both callbacks

@thelindat thelindat merged commit e5987d2 into overextended:main Jun 18, 2026
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

Successfully merging this pull request may close these issues.

2 participants