Skip to content

Clamp initial indexes before measuring covers - #46

Merged
vanderlee merged 2 commits into
masterfrom
agent/clamp-initial-index
Aug 3, 2026
Merged

vanderlee merged 2 commits into
masterfrom
agent/clamp-initial-index

Conversation

@vanderlee

Copy link
Copy Markdown
Owner

What changed

  • Return cleanly when a coverflow has no child covers.
  • Clamp the stored option index, current index, and requested index before the first frame is measured.
  • Preserve the file's existing line-ending format.

Why

When an initial index is larger than the number of covers, _setIndex() clamps only its local argument but calls _frame() while options.index is still out of range. _frame() then dereferences an absent cover's offsetWidth.

This directly addresses the failure reported with fewer than eight images and an initial index near the end of a larger collection.

Closes #45.

@vanderlee
vanderlee marked this pull request as ready for review August 3, 2026 19:17
@vanderlee
vanderlee merged commit a737132 into master Aug 3, 2026
1 check failed
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.

Coverflow error "offsetWidth" happens with less then 8 images.

1 participant