Page MenuHomeWildfire Games

Fix barter dialog in observermode when pressing the hotkey
ClosedPublic

Authored by elexis on Mar 29 2017, 1:06 AM.

Details

Summary

As reported by user1 in rP19354, when pressing the massbarter hotkey in observermode without having a player view selected, an error is thrown:

ERROR: JavaScript error: gui/session/menu.js line 792 TypeError: GetSimState(...).players[g_ViewedPlayer] is undefined updateBarterButtons@gui/session/menu.js:792:18 __eventhandler378 (release)@__internal(40) release:1:4

This must be the only case where this could occur, as the trade window can never be opened when not having selected a playerview (and the other function already having an early return or receiving the market owner).
With this fix, it wouldn't throw errors even if it were possible (see also #4476).

Test Plan

Start a game, resign, press shift. Apply the patch, do the same and enjoy the silence.

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

elexis created this revision.Mar 29 2017, 1:06 AM
user1 accepted this revision.Mar 29 2017, 1:23 AM

Test was successful.

This revision is now accepted and ready to land.Mar 29 2017, 1:23 AM
This revision was automatically updated to reflect the committed changes.

Thanks for the review!

Vulcan added a subscriber: Vulcan.Mar 29 2017, 1:52 AM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/629/ for more details.