diff options
Diffstat (limited to 'apps/pdfapp.c')
-rw-r--r-- | apps/pdfapp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/apps/pdfapp.c b/apps/pdfapp.c index ab29fcb9..0ef61e2d 100644 --- a/apps/pdfapp.c +++ b/apps/pdfapp.c @@ -139,11 +139,6 @@ static void pdfapp_open_pdf(pdfapp_t *app, char *filename, int fd) app->outline = pdf_load_outline(app->xref); - app->doctitle = fz_strdup(filename); - if (strrchr(app->doctitle, '\\')) - app->doctitle = strrchr(app->doctitle, '\\') + 1; - if (strrchr(app->doctitle, '/')) - app->doctitle = strrchr(app->doctitle, '/') + 1; info = fz_dict_gets(app->xref->trailer, "Info"); if (info) { @@ -151,6 +146,15 @@ static void pdfapp_open_pdf(pdfapp_t *app, char *filename, int fd) if (obj) app->doctitle = pdf_to_utf8(obj); } + if (!app->doctitle) + { + app->doctitle = filename; + if (strrchr(app->doctitle, '\\')) + app->doctitle = strrchr(app->doctitle, '\\') + 1; + if (strrchr(app->doctitle, '/')) + app->doctitle = strrchr(app->doctitle, '/') + 1; + app->doctitle = fz_strdup(app->doctitle); + } /* * Start at first page |