From e24d789f71991db9a74e3997653d9cf52d071749 Mon Sep 17 00:00:00 2001 From: bp-dev Date: Tue, 9 Jan 2018 13:46:21 -0500 Subject: [PATCH] Support patches with empty lines --- src/patch/apply.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/patch/apply.js b/src/patch/apply.js index 135e2411..408b3049 100644 --- a/src/patch/apply.js +++ b/src/patch/apply.js @@ -91,8 +91,8 @@ export function applyPatch(source, uniDiff, options = {}) { for (let j = 0; j < hunk.lines.length; j++) { let line = hunk.lines[j], - operation = line[0], - content = line.substr(1), + operation = line.length>0 ? line[0] : ' ', + content = line.length>0 ? line.substr(1) : line, delimiter = hunk.linedelimiters[j]; if (operation === ' ') {