"Cannot read property 'match' of null"
<p>I have that script: </p>

<pre><code>function getParameterByName(name, url) {
    if (!url) url = window.location.href;
    name = name.replace(/[\[\]]/g, "\\$&amp;");
    var regex = new RegExp("[?&amp;]" + name + "(=([^&amp;#]*)|&amp;|#|$)"),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, " "));
}

var dynamicContent = getParameterByName('utm_term');

$(document).ready(function() {

if (dynamicContent.match(/buy/i)) {
    $('#buy').show();
}

else {
    $('#default-content').show();
}
});
</code></pre>

<p>When in url there is any parametr it's working fine and else working, #deafult-content showing.</p>

<p>Problem that when i have clean url without parametr #default-content don't showing because "Cannot read property 'match' of null". </p>

<p>Any idea how to fix this?</p>