Return an error when URL is nil

Previous behavior was crash, this one is certainly better.