Skip to content

fix: handle get on empty lists - #190

Merged
rvagg merged 1 commit into
rvagg:masterfrom
fly1d:fix/empty-list-get
Nov 13, 2026
Merged

rvagg merged 1 commit into
rvagg:masterfrom
fly1d:fix/empty-list-get

Conversation

@fly1d

@fly1d fly1d commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

get(0) throws a TypeError on a new empty list or after consume() drains it. This affects both BufferList and BufferListStream, while an end index on a nonempty list already returns undefined.

Treat index === length as out of range before looking up an internal buffer. Add a separate Tape test for both classes, with boundary and append/reuse controls. The same final fixture executes all 12 new assertions on pristine code: four empty-list checks fail and eight controls pass; all 12 pass with the fix.

Validation on Node 26.5.0, macOS arm64: npm run build, full npm run test:ci (Standard, Tape, generated types and TypeScript checks), syntax checks and git diff --check pass. Generated tracked files remain unchanged. Other Node versions and operating systems were not run.

@rvagg rvagg left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@rvagg
rvagg merged commit 39b2047 into rvagg:master Nov 13, 2026
7 checks passed
github-actions Bot pushed a commit that referenced this pull request Nov 13, 2026
## [7.0.15](v7.0.14...v7.0.15) (2026-11-13)

### Bug Fixes

* handle get on empty lists ([#190](#190)) ([39b2047](39b2047))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 7.0.15 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants