Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Added dialog when no authentication provider is configured. [#744](https://github.com/sourcebot-dev/sourcebot/pull/744)

### Fixed
- Fixed "Invalid line number XXX in 21-line document" error when a invalid highlight range is passed to the file viewer. [#745](https://github.com/sourcebot-dev/sourcebot/pull/745)

## [4.10.11] - 2026-01-16

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ export const PureCodePreviewPanel = ({
const doc = editorRef.state.doc;
const { start, end } = highlightRange;

if (start.lineNumber > doc.lines || end.lineNumber > doc.lines) {
console.warn(`Highlight range is out of bounds: start.lineNumber=${start.lineNumber}, end.lineNumber=${end.lineNumber}, doc.lines=${doc.lines}`);
return;
}

const from = doc.line(start.lineNumber).from;
const to = doc.line(end.lineNumber).to;
const selection = EditorSelection.range(from, to);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export const rangeHighlightingExtension = (range: BrowseHighlightRange) => State
create(state) {
const { start, end } = range;

if (start.lineNumber > state.doc.lines || end.lineNumber > state.doc.lines) {
console.warn(`Highlight range is out of bounds: start.lineNumber=${start.lineNumber}, end.lineNumber=${end.lineNumber}, doc.lines=${state.doc.lines}`);
return Decoration.none;
}

if ('column' in start && 'column' in end) {
const from = state.doc.line(start.lineNumber).from + start.column - 1;
const to = state.doc.line(end.lineNumber).from + end.column - 1;
Expand Down