fix(report): NULL guard and deduplicate call in teletext JSON report

Follow-up to #2137:
- Add NULL check on private_data in tlt_print_seen_pages_json
- Remove duplicate get_sib_stream_by_type call in print_file_report_json

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Carlos Fernandez
2026-02-28 14:27:51 -08:00
parent 9614f58187
commit 98019fbf50
2 changed files with 7 additions and 2 deletions

View File

@@ -523,9 +523,9 @@ void print_file_report_json(struct lib_ccx_ctx *ctx)
printf(" },\n");
/* Teletext seen pages */
if (program_ci && get_sib_stream_by_type(program_ci, CCX_CODEC_TELETEXT))
struct cap_info *tlt_info = program_ci ? get_sib_stream_by_type(program_ci, CCX_CODEC_TELETEXT) : NULL;
if (tlt_info)
{
struct cap_info *tlt_info = get_sib_stream_by_type(program_ci, CCX_CODEC_TELETEXT);
struct lib_cc_decode *tlt_dec = update_decoder_list_cinfo(ctx, tlt_info);
if (tlt_dec && tlt_dec->codec == CCX_CODEC_TELETEXT)
{

View File

@@ -1369,6 +1369,11 @@ int tlt_print_seen_pages_json(struct lib_cc_decode *dec_ctx)
}
ctx = dec_ctx->private_data;
if (!ctx)
{
printf("[]");
return CCX_OK;
}
printf("[");
int first = 1;