Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: empty string linter overflow issues

Andrew Bastine4f40bce53be
diff --git a/packages/hoppscotch-app/helpers/editor/codemirror.ts b/packages/hoppscotch-app/helpers/editor/codemirror.ts
index f2b9526e9..7393fb760 100644
--- a/packages/hoppscotch-app/helpers/editor/codemirror.ts
+++ b/packages/hoppscotch-app/helpers/editor/codemirror.ts
@@ -102,8 +102,8 @@ const hoppLinterExt = (hoppLinter: LinterDefinition): Extension => {
const endPos = view.state.doc.line(result.to.line).from + result.to.ch - 1
return {
- from: startPos,
- to: endPos,
+ from: startPos < 0 ? 0 : startPos,
+ to: endPos > view.state.doc.length ? view.state.doc.length : endPos,
message: result.message,
severity: result.severity,
}