summaryrefslogtreecommitdiff
path: root/libspectre
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2018-10-13 00:39:28 +0200
committerAlbert Astals Cid <tsdgeos@yahoo.es>2018-10-19 15:29:36 +0000
commit818ff44e1e1e665efeeccc2a58c6453949368638 (patch)
tree4b4aa5df0b4e8c5f1b4cf517fdd9b65091c64f67 /libspectre
parentf4f8cb65e01e62c86354a6697307f9549136a66e (diff)
Fix crash with malformed document
Closes issue #14
Diffstat (limited to 'libspectre')
-rw-r--r--libspectre/ps.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libspectre/ps.c b/libspectre/ps.c
index fb84d80..62472b1 100644
--- a/libspectre/ps.c
+++ b/libspectre/ps.c
@@ -1065,7 +1065,7 @@ continuepage:
iscomment(line+2, "PageMedia:")) {
cp = ps_gettext(line+length("%%PageMedia:"), NULL);
for (dmp = doc->media, i=0; i<doc->nummedia; i++, dmp++) {
- if (strcmp(cp, dmp->name) == 0) {
+ if (cp && strcmp(cp, dmp->name) == 0) {
doc->pages[doc->numpages].media = dmp;
break;
}