Opened 8 years ago

Last modified 3 years ago

#3777 new defect

Idle-worker-hotkey errors after gamestart

Reported by: elexis Owned by:
Priority: Nice to Have Milestone: Backlog
Component: UI – In-game Keywords: simple
Cc: Patch:

Description (last modified by elexis)

Sometimes when starting a game and pressing the idle-worker hotkey, the following errors appear:

WARNING: JavaScript warning: simulation/components/GuiInterface.js line 1634
reference to undefined property data.prevUnit
ERROR: JavaScript error: simulation/components/GuiInterface.js line 1634
TypeError: data.excludeUnits is undefined
  GuiInterface.prototype.FindIdleUnits@simulation/components/GuiInterface.js:1634:1
  GuiInterface.prototype.ScriptCall@simulation/components/GuiInterface.js:1888:3
  findIdleUnit@gui/session/input.js:1730:7
  __eventhandler140 (press)@__internal(101) press:0:22
ERROR: Error calling component script function ScriptCall
ERROR: JavaScript error: gui/session/input.js line 1731
TypeError: idleUnits is undefined
  findIdleUnit@gui/session/input.js:1731:1
  __eventhandler140 (press)@__internal(101) press:0:22

The bug exists since a long time and had been reported here before #3227.

Tagging as simple since the scope is limited (input.js, GUIInterface.js).

The code should be looked at to see how these errors can occur, then finding a way to reproduce the errors reliably.

Thanks palaxin for reporting, just happened to get the error today.

Change History (8)

comment:1 by elexis, 8 years ago

Reproduce the bug by hitting alt+idle worker hotkey.

There is a keyboard bug with 0AD, at least on my ubuntu system (no matter if SDL 1.2 or 2), where the application behaves as if the alt button is pressed, when a game is started (while it actually hasn't been pressed). This keyboard bug is the cause why the error has occured only rarerly and only at gamestart before.

comment:2 by elexis, 6 years ago

Description: modified (diff)

Alpha 23 stack with the same reproduce recipe:

ERROR: JavaScript error: simulation/components/Cost.js line 48
TypeError: cmpPlayer is null
  Cost.prototype.GetBuildTime@simulation/components/Cost.js:48:19
  Repairable.prototype.GetBuildTime@simulation/components/Repairable.js:78:49
  GuiInterface.prototype.GetEntityState@simulation/components/GuiInterface.js:320:17
  GuiInterface.prototype.ScriptCall@simulation/components/GuiInterface.js:1970:1
  GetEntityState@gui/session/session.js:220:21
  findIdleUnit@gui/session/input.js:1629:20
  __eventhandler243 (press)@idleWorkerButton press:0:1
ERROR: Error calling component script function ScriptCall
ERROR: JavaScript error: gui/session/input.js line 1630
TypeError: entityState is undefined
  findIdleUnit@gui/session/input.js:1630:6
  __eventhandler243 (press)@idleWorkerButton press:0:1

comment:3 by Imarok, 5 years ago

Component: UI & SimulationIn-game UI

Move tickets to In-game UI as UI & Simulation got some sub components.

comment:4 by Freagarach, 4 years ago

I can't reproduce with alt-"idle worker hotkey", neither on A23b nor on r23595. Can you still, elexis?

Last edited 4 years ago by Freagarach (previous) (diff)

comment:5 by Freagarach, 4 years ago

Check for data.prevUnit introduced in r18139. (Not checked for data.excludeUnits being non-array or undefined.)

cmpPlayer in cmpCost replaced in r22964.

comment:6 by elexis, 4 years ago

Given that I could reproduce the error for years and that the affected UI code didn't change since a23, I have no reason to assume that the affected UI code fixed itself.

I think the bug is only reproducible if using some second bug, the alt key thing. On my ubuntu OS it had considered the Alt key pressed when starting the game, so when selecting units, only the military ones were selected at start. If one looks at the code, one should be able to infer which hotkeys might have been triggered in order to create the error message. If it was the Alt key only, it could be the offscreen hotkey, or perhaps there was a preselected entity, or undefined entity selected, etc. One can start at the stacktrace and then look under which conditions the error could occur.

comment:7 by Silier, 3 years ago

Keywords: simple removed
severity: simple

comment:8 by Silier, 3 years ago

Keywords: simple added
Note: See TracTickets for help on using tickets.