[pdfmod] [PdfSharp] Handle Outlines' iref pointing to null
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pdfmod] [PdfSharp] Handle Outlines' iref pointing to null
- Date: Thu, 3 Mar 2011 15:38:05 +0000 (UTC)
commit 973c365b7a9f3e5b58feedc51fb02a07413453e8
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu Mar 3 09:35:37 2011 -0600
[PdfSharp] Handle Outlines' iref pointing to null
If it does, remove it and recreate it. Fixes a bug in PDF Mod where
some documents would fail to load b/c the Outlines' iref pointed to null
(bgo#642379).
lib/PdfSharp/PdfSharp.Pdf.Advanced/PdfCatalog.cs | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/lib/PdfSharp/PdfSharp.Pdf.Advanced/PdfCatalog.cs b/lib/PdfSharp/PdfSharp.Pdf.Advanced/PdfCatalog.cs
index b995798..f785f00 100644
--- a/lib/PdfSharp/PdfSharp.Pdf.Advanced/PdfCatalog.cs
+++ b/lib/PdfSharp/PdfSharp.Pdf.Advanced/PdfCatalog.cs
@@ -145,8 +145,14 @@ namespace PdfSharp.Pdf.Advanced
{
get
{
- if (this.outline == null)
- this.outline = (PdfOutline)Elements.GetValue(Keys.Outlines, VCF.CreateIndirect);
+ if (this.outline == null) {
+ try {
+ this.outline = (PdfOutline)Elements.GetValue(Keys.Outlines, VCF.CreateIndirect);
+ } catch (InvalidOperationException) {
+ Elements.Remove (Keys.Outlines);
+ this.outline = (PdfOutline)Elements.GetValue(Keys.Outlines, VCF.CreateIndirect);
+ }
+ }
return this.outline.Outlines;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]