Check for null target in avoidProxy to prevent exceptions; Close #560.

From my pov, this should crash as soon as possible, meaning in setUrl where the illegal url is passed.