Fixed Jinja dependency scanning with dynamic deps

I realized today that I forgot to handle a specific case in my yesterday's patch.

If a Jinja template contains an include or extends with a variable instead
of a constant string, find_referenced_templates yields None for that
dependency. This could cause the dependency scanning algorithm to crash.