Skip to content

Commit

Permalink
Fix szimek#480 - Fix race condition / edge case in _strokeUpdate wher…
Browse files Browse the repository at this point in the history
…e this._data can sometimes be []
  • Loading branch information
ndbroadbent committed Apr 28, 2020
1 parent 7689c82 commit 7bb89ac
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/signature_pad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ export default class SignaturePad {
}

private _strokeUpdate(event: MouseEvent | Touch): void {
if (this._data.length === 0) {
// This can happen if clear() was called while a signature is still in progress,
// or if there is a race condition between start/update events.
this._strokeBegin(event)
return
}

const x = event.clientX;
const y = event.clientY;

Expand Down

0 comments on commit 7bb89ac

Please sign in to comment.