Forum Discussion

elesniewski's avatar
Occasional Contributor
6 years ago

TypeError: Cannot read property 'push' of null .. well, sometimes

I have a scenario where I setup a variable of Type Object with Default value: {Object variable [unassigned]} This will be populated with an array of sql query output.  On first run of the test, the...
  • elesniewski's avatar
    6 years ago

    That works, too, but, to solve this issue I found I needed to change the following:


    if (KeywordTests.Main.Variables.ourArray != null)

    change to:
    if (KeywordTests.Main.Variables.ourArray != '')

     If I use null here, an empty string is passed to the sql query, causing the syntax error.  If I use '' instead of null, no worries.   Thanks.