Opened 2 years ago

Closed 2 years ago

#6429 closed defect (fixed)

[BUG] Barter&Trade button causes errors

Reported by: Langbart Owned by: Silier
Priority: Should Have Milestone: Alpha 26
Component: UI – In-game Keywords:
Cc: Patch:

Description (last modified by Langbart)

Error message appear when using the Barter&Trade button.

to reproduce

  • Watch a replay
  • Select a player with the playerviewcontrol
  • Press the Barter&Trade button
  • Select observer mode via the playerviewcontrol

(the issue is not reproducible with the Diplomacy button)

error codes

0 A.D. (0.0.26) Main log (warnings and errors only)
ERROR: JavaScript error: gui/session/trade/TradeDialogBarterPanel.js line 27 Script value conversion check failed: v.isBoolean() (got type undefined) update@gui/session/trade/TradeDialogBarterPanel.js:27:3 updatePanels@gui/session/trade/TradeDialog.js:67:20 updateIfOpen@gui/session/trade/TradeDialog.js:62:9 onSimulationUpdate@gui/session/session.js:675:3 resetTemplates@gui/session/session.js:448:2 onSelectionChange@gui/session/top_panel/PlayerViewControl.js:119:4

ERROR: Errors executing script event "SelectionChange"

ERROR: JavaScript error: gui/session/trade/TradeDialogBarterPanel.js line 27 JS_ReportError was called update@gui/session/trade/TradeDialogBarterPanel.js:27:3 updatePanels@gui/session/trade/TradeDialog.js:67:20 updateIfOpen@gui/session/trade/TradeDialog.js:62:9 onSimulationUpdate@gui/session/session.js:675:3 resetTemplates@gui/session/session.js:448:2 onSelectionChange@gui/session/top_panel/PlayerViewControl.js:119:4

ERROR: JavaScript error: gui/session/trade/TradeDialogBarterPanel.js line 27 Script value conversion check failed: v.isBoolean() (got type undefined) update@gui/session/trade/TradeDialogBarterPanel.js:27:3 updatePanels@gui/session/trade/TradeDialog.js:67:20 updateIfOpen@gui/session/trade/TradeDialog.js:62:9 onTick@gui/session/session.js:631:4 __eventhandler52 (Tick)@session Tick:1:1

ERROR: Errors executing script event "Tick"
...

reproducible

The issue is reproducible for A25b [25860] , but not for A24b [24937].

bisect

The issue can be noticed for the first time with [25365].

solution(1)

Simply adding || false to Line 27 in TradeDialogBarterPanel.js

Line 
20 update()
21 {
22 let playerState = GetSimState().players[g_ViewedPlayer];
23 let canBarter = playerState && playerState.canBarter;
24
25 this.barterButtonManager.setViewedPlayer(g_ViewedPlayer);
26 this.barterButtonManager.update();
27 this.barterNoMarketsMessage.hidden = canBarter *|| false*;
28 this.barterResources.hidden = !canBarter;
29 this.barterHelp.hidden = !canBarter;
30 this.barterHelp.tooltip = sprintf(
31 translate(this.InstructionsTooltip), {
32 "quantity": this.barterButtonManager.getSelectedButton().BarterResourceSellQuantity,
33 "hotkey": colorizeHotkey("%(hotkey)s", "session.massbarter"),
34 "multiplier": this.barterButtonManager.getSelectedButton().Multiplier
35 });
36 }
37};

Attachments (1)

barter_trade_button.gif (749.7 KB ) - added by Langbart 2 years ago.

Download all attachments as: .zip

Change History (4)

by Langbart, 2 years ago

Attachment: barter_trade_button.gif added

comment:1 by Langbart, 2 years ago

Description: modified (diff)

Adding the commit number where the problem can be noticed for the first time.

comment:2 by Langbart, 2 years ago

Description: modified (diff)

adding a possible solution to the issue

comment:3 by Silier, 2 years ago

Owner: set to Silier
Resolution: fixed
Status: newclosed

In 26325:

Fix missing implicit conversion in TradeDialogBarterPanel

undefined is not boolean

Implicit conversions required since rP25365

Fixes: #6429

Note: See TracTickets for help on using tickets.