Skip to content

Commit

Permalink
fix possible null destructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Aug 1, 2018
1 parent def8ddb commit 0b34aa8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ class Clipboard extends Module {
nodeMatches,
);
// Remove trailing newline
const { attributes } = delta.ops[delta.ops.length - 1];
if (deltaEndsWith(delta, '\n') && (attributes == null || formats.table)) {
if (
deltaEndsWith(delta, '\n') &&
(delta.ops[delta.ops.length - 1].attributes == null || formats.table)
) {
return delta.compose(new Delta().retain(delta.length() - 1).delete(1));
}
return delta;
Expand Down

0 comments on commit 0b34aa8

Please sign in to comment.