diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-11-14 20:23:41 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-11-22 16:52:38 +0100 |
commit | 3f608056b53cf55ed76983d92c32e5a94da1427e (patch) | |
tree | e693c153ab2280262dcf714d2832f59bd9daba39 /apps | |
parent | 84037901d3838b85f7c4d61b191376ce2e32b909 (diff) | |
download | mupdf-3f608056b53cf55ed76983d92c32e5a94da1427e.tar.xz |
Fix bug where app->doctitle wasn't pointing to an alloced string.
Diffstat (limited to 'apps')
-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 |