CleverRaven/Cataclysm-DDA — pull request #6878 by kevingranade (2014-03-24 06:27:47+00:00)
Title: Prevent segfault in the unlikely case that you miss so badly...

...that you shoot yourself.
It seems that in the unlikely event of missing and the game choosing the originating square as the new target, it can trigger a segfault because it creates a 0-length trajectory vector, then tries to dereference it. This sidesteps the issue by not accessing the vector outside the loop, which will automatically exit if the vector is empty.