From 97931e1470880f644ec6efefcce8f2bab33f8b30 Mon Sep 17 00:00:00 2001 From: yzrh Date: Thu, 29 Dec 2022 05:23:04 +0000 Subject: Fix PDF object check. Signed-off-by: yzrh --- src/cnki_pdf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/cnki_pdf.c') 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"); -- cgit v1.2.3