Avatars no longer get replaced by empty images.

When replacing an avatar URL with its CDN version,
it was possible to replace it with an invalid URL due to a bug in error checking.