fix a NPE when a pipe unloads with an item heading towards it.

this code assumes that arriving at the next pipe will re-route it; the
sending of an item to a pipe that doesn't currently exist needs to be
detected earlier.