When holding the Alt+S/W hotkey and loading gamesetup, it will crash, since the buttons are only initialized after the first tick (this is required in gamesetup since it is waiting on netmessages), but the hotkey already is active and tries to use uninitializes variables, checking for the tabsCount solves the issue (and doesn't break other pages)
Details
Hold Alt+S/W to see the crash and not crash with the patch
Make sure other pages still work
nitpick about a prototype
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Error reported here:
https://code.wildfiregames.com/rP20945#27266
ERROR: JavaScript error: gui/gamesetup/gamesetup.js line 2248
TypeError: g_SettingsTabsGUI[g_TabCategorySelected] is undefined
updateGUIObjects@gui/gamesetup/gamesetup.js:2248:1
initGUIObjects/<@gui/gamesetup/gamesetup.js:1204:4
selectPanel@gui/common/tab_buttons.js:74:2
placeTabButtons@gui/common/tab_buttons.js:51:2
initGUIObjects@gui/gamesetup/gamesetup.js:1196:1
onTick@gui/gamesetup/gamesetup.js:1909:3
__eventhandler388 (tick)@setupWindow tick:0:1
binaries/data/mods/public/gui/common/tab_buttons.js | ||
---|---|---|
4 ↗ | (On Diff #5418) | unavoidable? |
binaries/data/mods/public/gui/common/tab_buttons.js | ||
---|---|---|
4 ↗ | (On Diff #5418) | Well the problem is that selectNextTab starts changing the value of g_TabCategorySelected, without knowing the length (and so currupting the value of g_TabCategorySelected), ERROR: JavaScript error: gui/common/tab_buttons.js line 74 TypeError: g_OnSelectTab is not a function selectPanel@gui/common/tab_buttons.js:74:2 selectNextTab@gui/common/tab_buttons.js:60:1 __eventhandler45 (press)@__internal(10) press:0:1 Instead of having the init flag, we can also check for the g_TabCategoryCount instead. |