url-helpers: Fixed a crasher in `url_shorten_reference()`.

`url_shorten_reference()` is a real mess. A better fix would be to
rewrite it, but I don't have the time right now.