Lexer: Check curStr is actually a Stream before doing Stream operations

Bug #104518
diff --git a/poppler/Lexer.cc b/poppler/Lexer.cc
index 70e0053..3089da3 100644
--- a/poppler/Lexer.cc
+++ b/poppler/Lexer.cc
@@ -97,12 +97,14 @@
   strPtr = 0;
   if (streams->getLength() > 0) {
     curStr = streams->get(strPtr);
-    curStr.streamReset();
+    if (curStr.isStream()) {
+      curStr.streamReset();
+    }
   }
 }
 
 Lexer::~Lexer() {
-  if (!curStr.isNone()) {
+  if (curStr.isStream()) {
     curStr.streamClose();
   }
   if (freeArray) {
@@ -120,7 +122,7 @@
   }
 
   c = EOF;
-  while (!curStr.isNone() && (c = curStr.streamGetChar()) == EOF) {
+  while (curStr.isStream() && (c = curStr.streamGetChar()) == EOF) {
     if (comesFromLook == gTrue) {
       return EOF;
     } else {
@@ -128,8 +130,10 @@
       curStr = Object();
       ++strPtr;
       if (strPtr < streams->getLength()) {
-        curStr = streams->get(strPtr);
-        curStr.streamReset();
+	curStr = streams->get(strPtr);
+	if (curStr.isStream()) {
+	  curStr.streamReset();
+	}
       }
     }
   }