Fixing NPE in dependency logic.

This is a quick-fix, and I'm perfectly fine with that because the code
I fixed is disappearing soon anyway (we currently calculate dependencies
incorrectly; there is a ticket describing that we need to undo a lot of
work we did because it was actually wrong)