Skip to content

Commit

Permalink
fix: adds null check
Browse files Browse the repository at this point in the history
  • Loading branch information
ahennr authored and simonseyock committed May 6, 2024
1 parent a88b54b commit 5a78b77
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Button/MeasureButton/MeasureButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,12 @@ export const MeasureButton: FC<MeasureButtonProps> = ({
const onMapClickKey = map?.on('click', onMapClick);

return () => {
unByKey(onDrawStartKey);
unByKey(onDrawEndKey);
if (!_isNil(onDrawStartKey)) {
unByKey(onDrawStartKey);
}
if (!_isNil(onDrawEndKey)) {
unByKey(onDrawEndKey);
}
if (onMapPointerMoveKey) {
unByKey(onMapPointerMoveKey);
}
Expand Down

0 comments on commit 5a78b77

Please sign in to comment.