Protect against exception when onpopstate/onhashchange are null

Without this patch, the following will throw an exception:

    router = Router(routes)
    router.configure({
      notfound: function() { router.setRoute('/'); }
    });
    router.init();

In the early stages of page load, `window.onpopstate` and `window.onhashchange` are `null` (in Chrome, anyway).