Prevent javascript error when no query string is present

The regex match returns null when no matches are found; this causes the forEach method to fail.
My fix ensures that null doesn't get passed to the forEach.