diff options
author | yzrh <yzrh@noema.org> | 2022-12-29 05:23:04 +0000 |
---|---|---|
committer | yzrh <yzrh@noema.org> | 2022-12-29 05:23:04 +0000 |
commit | 97931e1470880f644ec6efefcce8f2bab33f8b30 (patch) | |
tree | 039bc4a3c46bac774a32ec371a9a2b2c97f0cd19 /src | |
parent | cd0af5ba3ceee50b1c8a287149b48b2f4cb7ce0b (diff) | |
download | melon-97931e1470880f644ec6efefcce8f2bab33f8b30.tar.gz melon-97931e1470880f644ec6efefcce8f2bab33f8b30.tar.zst |
Fix PDF object check.
Signed-off-by: yzrh <yzrh@noema.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/cnki_pdf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cnki_pdf.c b/src/cnki_pdf.c index 502a0ce..328a989 100644 --- a/src/cnki_pdf.c +++ b/src/cnki_pdf.c @@ -322,12 +322,13 @@ cnki_pdf(cnki_t **param) root = i; } - if ((*param)->stat > 0) - printf("Root object is %d.\n", - root); + if (root == 0) + root = pdf_get_free_id(&pdf); + else if ((*param)->stat > 0) + printf("Root object is %d.\n", root); } - if (pdf_get_kid_count(&pdf, root) == 0) { + if (pdf_get_obj(&pdf, root, NULL) != 0) { if ((*param)->stat > 0) printf("Root object is missing\n"); |