Skip to content

Commit f030714

Browse files
author
sjw
committed
Remove some assert
1 parent ef07d5e commit f030714

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

source/hdtd/context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ hd_drop_context(hd_context *ctx)
2121

2222
if (ctx->error)
2323
{
24-
assert(ctx->error->top == ctx->error->stack - 1);
24+
//assert(ctx->error->top == ctx->error->stack - 1);
2525
hd_free(ctx, ctx->error);
2626
}
2727

source/pdf/pdf-xref.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,11 @@ pdf_obj *
931931
pdf_load_object(hd_context *ctx, pdf_document *doc, int num)
932932
{
933933
pdf_xref_entry *entry = pdf_cache_object(ctx, doc, num);
934-
assert(entry->obj != NULL);
935-
return pdf_keep_obj(ctx, entry->obj);
934+
//assert(entry->obj != NULL);
935+
if (entry->obj != NULL)
936+
return pdf_keep_obj(ctx, entry->obj);
937+
else
938+
return NULL;
936939
}
937940

938941
static void
@@ -1039,12 +1042,12 @@ pdf_init_document(hd_context *ctx, pdf_document *doc)
10391042
hd_try(ctx)
10401043
{
10411044
dict = pdf_load_object(ctx, doc, i);
1045+
if (dict == NULL)
1046+
hd_throw(ctx, HD_ERROR_GENERIC, "ignoring broken object (%d 0 R)", i);
10421047
}
10431048
hd_catch(ctx)
10441049
{
1045-
hd_rethrow_if(ctx, HD_ERROR_TRYLATER);
1046-
hd_warn(ctx, "ignoring broken object (%d 0 R)", i);
1047-
continue;
1050+
hd_rethrow(ctx);
10481051
}
10491052

10501053
if (!hasroot)

0 commit comments

Comments
 (0)