From 12471bf051af2e77918508a6b24692065a33e5a1 Mon Sep 17 00:00:00 2001 From: Sai Asish Y Date: Wed, 17 Jun 2026 18:41:06 -0700 Subject: [PATCH] docs: guard against NULL history.entries in README example Signed-off-by: Sai Asish Y --- README.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 750df4ba..bc8adc02 100644 --- a/README.rst +++ b/README.rst @@ -107,8 +107,9 @@ the ASDF tree, as well as extract block data. Inline comments provide further e // This reads the top-level core/asdf-1.0.0 schema err = asdf_get_meta(file, "/", &meta); if (err == ASDF_VALUE_OK) { - if (meta->history.entries[0]) { - // This is a NULL-terminated array of asdf_history_entry_t* + // `entries` is NULL when the file has no history, and otherwise a + // NULL-terminated array of asdf_history_entry_t*, so check both. + if (meta->history.entries && meta->history.entries[0]) { printf("first history entry: %s\n", meta->history.entries[0]->description); } }