[pdfmod] [PdfSharp] Fix exception thrown loading a PDF I have



commit 981be310e524f7177a900d21ccd0d735c036e73f
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Thu Aug 6 18:13:48 2009 -0700

    [PdfSharp] Fix exception thrown loading a PDF I have

 src/Libraries/PdfSharp/PdfSharp.Pdf.IO/Lexer.cs |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/Libraries/PdfSharp/PdfSharp.Pdf.IO/Lexer.cs b/src/Libraries/PdfSharp/PdfSharp.Pdf.IO/Lexer.cs
index f489d0e..37494be 100644
--- a/src/Libraries/PdfSharp/PdfSharp.Pdf.IO/Lexer.cs
+++ b/src/Libraries/PdfSharp/PdfSharp.Pdf.IO/Lexer.cs
@@ -727,11 +727,14 @@ namespace PdfSharp.Pdf.IO
         }
         if (char.IsLetterOrDigit(this.currChar))
         {
-          hex[0] = char.ToUpper(this.currChar);
-          hex[1] = char.ToUpper(this.nextChar);
-          int ch = int.Parse(new string(hex), NumberStyles.AllowHexSpecifier);
-          this.token.Append(Convert.ToChar(ch));
-          ScanNextChar();
+          if (char.IsLetterOrDigit(this.nextChar))
+          {
+            hex[0] = char.ToUpper(this.currChar);
+            hex[1] = char.ToUpper(this.nextChar);
+            int ch = int.Parse(new string(hex), NumberStyles.AllowHexSpecifier);
+            this.token.Append(Convert.ToChar(ch));
+            ScanNextChar();
+          }
           ScanNextChar();
         }
       }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]