Skip to content

fix: Clamp section index to prevent out-of-bounds error#2

Open
recynie wants to merge 1 commit into
data-8:mainfrom
recynie:fix/question-without-section
Open

fix: Clamp section index to prevent out-of-bounds error#2
recynie wants to merge 1 commit into
data-8:mainfrom
recynie:fix/question-without-section

Conversation

@recynie
Copy link
Copy Markdown

@recynie recynie commented May 17, 2026

When #question is used before any #section is defined, section-counter is 0, causing section index to become -1 and triggering an array index out of bounds error. Use calc.max(..., 0) to guard against this.

Fixes #1

…error

When #question is used before any #section is defined, section-counter
is 0, causing section index to become -1 and triggering an array index
out of bounds error. Use calc.max(..., 0) to guard against this.

Fixes data-8#1
Copilot AI review requested due to automatic review settings May 17, 2026 11:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an out-of-bounds error when point-bearing questions are added before any numbered section exists by clamping the computed section index to zero.

Changes:

  • Prevents add-points from using -1 as an array index when section-counter is still zero.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

question is not working

2 participants