Skip to content

Commit

Permalink
fix: prevent crash when the pad amount is negative (#8747)
Browse files Browse the repository at this point in the history
  • Loading branch information
Haegin authored Jun 30, 2022
1 parent 4eb2348 commit 3af6a1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ export function generateCodeFrame(
const lineLength = lines[j].length
if (j === i) {
// push underline
const pad = start - (count - lineLength) + 1
const pad = Math.max(start - (count - lineLength) + 1, 0)
const length = Math.max(
1,
end > count ? lineLength - pad : end - start
Expand Down

0 comments on commit 3af6a1b

Please sign in to comment.