summaryrefslogtreecommitdiff
path: root/platform/ios/Classes
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-11-18 13:02:01 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-11-21 11:11:46 +0100
commitbff572a7365209f36a16951296384974c80ad3d5 (patch)
tree7d63479831c8edc24bc5933a1ef61c376a8dd6b2 /platform/ios/Classes
parentac6ebbe38e6edb6074b1b73707770a9a4e9979b8 (diff)
downloadmupdf-bff572a7365209f36a16951296384974c80ad3d5.tar.xz
Harden viewers against failures when loading outlines.
Ignore invalid page references in outlines. This was shown by a file that had [null 0 0 1] as a link dest. Attempting to parse that threw an error, which caused the whole outline load to fail.
Diffstat (limited to 'platform/ios/Classes')
-rw-r--r--platform/ios/Classes/MuDocumentController.m12
1 files changed, 10 insertions, 2 deletions
diff --git a/platform/ios/Classes/MuDocumentController.m b/platform/ios/Classes/MuDocumentController.m
index 532ee411..ba18dee2 100644
--- a/platform/ios/Classes/MuDocumentController.m
+++ b/platform/ios/Classes/MuDocumentController.m
@@ -272,7 +272,11 @@ static void saveDoc(const char *current_path, fz_document *doc)
// Set up the buttons on the navigation and search bar
- fz_outline *outlineRoot = fz_load_outline(ctx, doc);
+ fz_outline *outlineRoot;
+ fz_try(ctx)
+ outlineRoot = fz_load_outline(ctx, doc);
+ fz_catch(ctx)
+ outlineRoot = NULL;
if (outlineRoot)
{
// only show the outline button if there is an outline
@@ -471,7 +475,11 @@ static void saveDoc(const char *current_path, fz_document *doc)
- (void) onShowOutline: (id)sender
{
// rebuild the outline in case the layout has changed
- fz_outline *root = fz_load_outline(ctx, doc);
+ fz_outline *root;
+ fz_try(ctx)
+ root = fz_load_outline(ctx, doc);
+ fz_catch(ctx)
+ root = NULL;
if (root)
{
NSMutableArray *titles = [[NSMutableArray alloc] init];