soundcloud / soundcloud-custom-player

The SoundCloud custom javascript based player
http://soundcloud.com
707 stars 231 forks source link

gaGlobal Variable Not Initializing #33

Open kand opened 12 years ago

kand commented 12 years ago

Firebug throws an error on this anonymous script:

function () {
    try {
        gaGlobal;
    } catch (e) {
        gaGlobal = {};
    }
}

My only clue as to where this is located is firebug says it's in '/event/seq/2/'

The issue here is that if gaGlobal has never been created before, it will indeed throw an error and firebug will stop. Instead of using a try/catch block, I would recommend that this non-error-throwing code snippet be used instead:

if(typeof gaGlobal === 'undefined') gaGlobal = {};

This will accomplish the same effect, avoid the usage of a try/catch, and Firebug won't be so unhappy.