diff options
-rw-r--r-- | src/PostscriptDSC.cxx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/PostscriptDSC.cxx b/src/PostscriptDSC.cxx index dfc9775..985722d 100644 --- a/src/PostscriptDSC.cxx +++ b/src/PostscriptDSC.cxx @@ -120,14 +120,18 @@ PostscriptDSC::parse(int fd) { } } } + + if (page_len && page_off) { + page_len[p1 - 1] = ftello(fp) - page_off[p1 - 1]; - page_len[p1 - 1] = ftello(fp) - page_off[p1 - 1]; - - for (int i=0; i<pages; i++) { - if (page_off[i] == 0 || page_len[i] == 0) { - fprintf(stderr, "Page %d not defined\n", i); - return 1; + for (int i=0; i<pages; i++) { + if (page_off[i] == 0 || page_len[i] == 0) { + fprintf(stderr, "Page %d not defined\n", i); + return 1; + } } + } else { + return 1; } return 0; |