ajaxCall() does'nt check parameters

Game development with Board Game Arena Studio
Post Reply
User avatar
zigareth
Posts: 7
Joined: 27 October 2020, 18:49

ajaxCall() does'nt check parameters

Post by zigareth »

I can observe the following in the DevTools when calling ajaxCall() in one of the handled states in onEnteringState() of my ziga.js file :

Code: Select all

ly_studio.js:formatted:26994 Uncaught TypeError: Cannot set property 'table' of undefined
    at Object.ajaxcall (ly_studio.js:formatted:26994)
    at HTMLInputElement.<anonymous> (ziga.js?1605306221109:99)
This leads to the definition of ajaxCall() :

Code: Select all

                    ajaxcall: function() {
                        var url = arguments[0];
                        if (g_archive_mode) {
[...]
                        } else {
                            if (url.charAt(0) == "/") {
                                var _d6e = "/" + this.game_name + "/" + this.game_name;
                                if (url.substr(0, _d6e.length) == _d6e) {
                                    arguments[0] = url.substr(1);
                                } else {}
                            }
                        }
                        arguments[1].table = this.table_id;
                        if (this.forceTestUser !== null) {
                            arguments[1].testuser = this.forceTestUser;
                        }
                        return this.inherited(arguments);
                    },
I tumbled upon this when missing a second parameter to ajaxCall(),
It looks here that arguments[1] is never checked and ajaxCall() would probably benefit from checking the arguments array. In this case, arguments[1] was undefined. Number of parameters in ajaxCalls would benefit being checked.

Zig
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: ajaxCall() does'nt check parameters

Post by Victoria_La »

If this is suggestion you can send bug https://studio.boardgamearena.com/bugs
Post Reply

Return to “Developers”