Skip to content

Commit a803d10

Browse files
committed
Fix RmlUi mode detection in MainWindowPanel
The check 'SB.view and SB.view.useRmlUi' failed during initialization because SB.view isn't assigned until AFTER View() constructor completes. Timeline: 1. View:InitializeRmlUi() runs (inside View constructor) 2. Creates TabbedWindow which calls MainWindowPanel:AddElement() 3. SB.view is STILL NIL (not assigned yet) 4. Check fails, goes to Chili mode path 5. But editors are RmlUi editors (field compat loaded) 6. RmlUi editors don't have .window → crash Fix: Detect RmlUi mode by checking if RmlUiStringField exists (which it will if field compat layer is loaded). Fixes: attempt to index field 'window' (a nil value) at line 131
1 parent 36d9a1a commit a803d10

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scen_edit/view/main_window/main_window_panel.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,12 @@ function MainWindowPanel:AddElement(tbl)
9494
local name = tbl.name
9595
local editor = tbl.editor
9696

97+
-- Detect RmlUi mode - check if RmlUi field compat layer is loaded
98+
-- (SB.view might not be set yet during initialization)
99+
local useRmlUi = RmlUi ~= nil and RmlUiStringField ~= nil
100+
97101
-- In RmlUi mode, skip Chili button creation but still create editors
98-
if SB.view and SB.view.useRmlUi then
102+
if useRmlUi then
99103
SB.delay(function()
100104
if not SB.editors[name] then
101105
SB.editors[name] = editor()

0 commit comments

Comments
 (0)