Skip to content

Commit 122b8f9

Browse files
committed
Safeguard callback handlers and fix callback names
1 parent 6a30bb0 commit 122b8f9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Circle.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ class Circle extends Component {
7474
}
7575

7676
onCircleCallback(callback, event) {
77-
this.props[callback](this.circle, event);
77+
if (this.props[callback]) {
78+
this.props[callback](this.circle, event);
79+
}
7880
}
7981

8082
renderCircle(props) {
@@ -158,8 +160,8 @@ Circle.defaultProps = {
158160
onMouseUp: (circle) => {},
159161
onRadiusChanged: (circle) => {},
160162
onRightClick: (circle) => {},
161-
onVisibleChange: (circle) => {},
162-
onZIndexChange: (circle) => {},
163+
onVisibleChanged: (circle) => {},
164+
onZIndexChanged: (circle) => {},
163165
};
164166

165167
export default Circle;

src/Marker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ class Marker extends Component {
6868
}
6969

7070
onMarkerCallback(callback, event) {
71-
this.props[callback](this.marker, event);
71+
if (this.props[callback]) {
72+
this.props[callback](this.marker, event);
73+
}
7274
}
7375

7476
renderMarker(props) {

0 commit comments

Comments
 (0)