Skip to content

Commit e24d789

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

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/patch/apply.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ export function applyPatch(source, uniDiff, options = {}) {
9191

9292
for (let j = 0; j < hunk.lines.length; j++) {
9393
let line = hunk.lines[j],
94-
operation = line[0],
95-
content = line.substr(1),
94+
operation = line.length>0 ? line[0] : ' ',
95+
content = line.length>0 ? line.substr(1) : line,
9696
delimiter = hunk.linedelimiters[j];
9797

9898
if (operation === ' ') {

0 commit comments

Comments
 (0)