From 02ef78e174f6ac38fb76b8031bff583ab16f7582 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 2 Oct 2021 18:05:24 -0400 Subject: [PATCH] Changeset: Make sure `opOut` is cleared `slicerZipperFunc()` previously assumed the provided `opOut` argument was a null Op. Enforce this by clearing it at the beginning. --- src/static/js/Changeset.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/static/js/Changeset.js b/src/static/js/Changeset.js index 020c34e10..9dc101701 100644 --- a/src/static/js/Changeset.js +++ b/src/static/js/Changeset.js @@ -1179,6 +1179,7 @@ exports.composeAttributes = (att1, att2, resultIsMutation, pool) => { * @param {AttributePool} pool - Can be null if definitely not needed. */ const slicerZipperFunc = (attOp, csOp, opOut, pool) => { + clearOp(opOut); if (attOp.opcode === '-') { copyOp(attOp, opOut); attOp.opcode = ''; @@ -2221,6 +2222,7 @@ exports.follow = (cs1, cs2, reverseInsertOrder, pool) => { const hasInsertFirst = exports.attributeTester(['insertorder', 'first'], pool); const newOps = applyZip(unpacked1.ops, unpacked2.ops, (op1, op2, opOut) => { + clearOp(opOut); if (op1.opcode === '+' || op2.opcode === '+') { let whichToDo; if (op2.opcode !== '+') {