Check for url before url.match

If we do not check if url is set, we may get an "Uncaught TypeError: Cannot call method 'match' of undefined".