HeaderSearch currently assumes LookupFileCache is eventually populated in LookupFile. However, that's not always the case with -fms-compatibility and its early returns.
This patch adds a defensive check that the iterator pulled out of the cache is actually valid before using it.
(This bug was introduced in D119721. Before that, the cache was initialized to 0 - essentially the search_dir_begin() iterator.)