Crash on broken internal query without index

Based on https://github.com/gjtorikian/html-proofer/issues/41#issuecomment-52594922 by @nschonni

I will try to fix it here.
This looks like a poem. @parkr do you have an advice how to omit the redundancy?