Check URL before navigation

Fixed an error when an invalid url is given in the address bar.