Skip to content

Commit 5a78b77

Browse files
ahennrsimonseyock
authored andcommitted
fix: adds null check
1 parent a88b54b commit 5a78b77

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Button/MeasureButton/MeasureButton.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,12 @@ export const MeasureButton: FC<MeasureButtonProps> = ({
517517
const onMapClickKey = map?.on('click', onMapClick);
518518

519519
return () => {
520-
unByKey(onDrawStartKey);
521-
unByKey(onDrawEndKey);
520+
if (!_isNil(onDrawStartKey)) {
521+
unByKey(onDrawStartKey);
522+
}
523+
if (!_isNil(onDrawEndKey)) {
524+
unByKey(onDrawEndKey);
525+
}
522526
if (onMapPointerMoveKey) {
523527
unByKey(onMapPointerMoveKey);
524528
}

0 commit comments

Comments
 (0)