Skip to content

docs: guard against NULL history.entries in README example#199

Closed
SAY-5 wants to merge 1 commit into
asdf-format:mainfrom
SAY-5:fix-history-entries-null-guard
Closed

docs: guard against NULL history.entries in README example#199
SAY-5 wants to merge 1 commit into
asdf-format:mainfrom
SAY-5:fix-history-entries-null-guard

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jun 18, 2026

Copy link
Copy Markdown

Closes #196. The cube example does meta->history.entries[0] directly, but entries is NULL when the file has no history (it only gets allocated when the history mapping has an "entries" key, see src/core/asdf.c), so the example segfaults on any file without a history entry. Added a NULL check on entries itself before indexing it.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@embray

embray commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

@SAY-5 Thanks for this. I'm sorry you had to take the time -- I already started a broader update to this example code which also includes this fix. Your PR reminded me that I haven't finished that yet. Let me see where I left off..

@embray

embray commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Superseded by #201

@embray embray closed this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running cube example in readme can crash on some files

2 participants