Skip to content

Commit

Permalink
improve EngineMupdf::GetNamedDest() to return null if not a valid des…
Browse files Browse the repository at this point in the history
…tination
  • Loading branch information
kjk committed Nov 14, 2023
1 parent cfee04c commit 40afb24
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/EngineMupdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ static int ResolveLink(fz_context* ctx, fz_document* doc, const char* uri, float
fz_report_error(ctx);
pageNo = -1;
}

if (pageNo < 0) {
return -1;
}
return pageNo + 1;
}

Expand Down Expand Up @@ -2368,6 +2370,9 @@ IPageDestination* EngineMupdf::GetNamedDest(const char* name) {
char* uri = str::JoinTemp("#nameddest=", name);
float x, y, zoom = 0;
int pageNo = ResolveLink(ctx, _doc, uri, &x, &y);
if (pageNo < 0) {
return nullptr;
}

RectF r{x, y, 0, 0};
pageDest = NewSimpleDest(pageNo, r, zoom);
Expand Down

0 comments on commit 40afb24

Please sign in to comment.