Skip to content

Commit 8616a02

Browse files
bp-devkpdecker
authored andcommitted
Support patches with empty lines
1 parent fb0f208 commit 8616a02

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/patch/apply.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export function applyPatch(source, uniDiff, options = {}) {
3434
function hunkFits(hunk, toPos) {
3535
for (let j = 0; j < hunk.lines.length; j++) {
3636
let line = hunk.lines[j],
37-
operation = line[0],
38-
content = line.substr(1);
37+
operation = line.length>0 ? line[0] : ' ',
38+
content = line.length>0 ? line.substr(1) : line;
3939

4040
if (operation === ' ' || operation === '-') {
4141
// Context sanity check

0 commit comments

Comments
 (0)