FontInfoScanner::scanFonts Fix infinite loop in broken files

Fixes #752
diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc
index 2c3be4c..cd33577 100644
--- a/poppler/FontInfo.cc
+++ b/poppler/FontInfo.cc
@@ -144,7 +144,17 @@
 
         Object obj2 = dictObjI.fetch(xrefA);
         if (obj2.isStream()) {
-          Object resObj = obj2.streamGetDict()->lookup("Resources");
+          Ref resourcesRef;
+          const Object resObj = obj2.streamGetDict()->lookup("Resources", &resourcesRef);
+
+          if (resourcesRef != Ref::INVALID()) {
+            if (visitedObjects.find(resourcesRef.num) != visitedObjects.end()) {
+              continue;
+            }
+
+            visitedObjects.insert(resourcesRef.num);
+          }
+
           if (resObj.isDict() && resObj.getDict() != resDict) {
             scanFonts(xrefA, resObj.getDict(), fontsList);
           }