Check URL length, protect from nil pointers

* Both of these are conditions that can be raised from inside of test
cases.