Skip to content

Commit 206ac4b

Browse files
authored
Merge pull request #27 from wmeler/master
Fix error:Cannot read property 'setMap' of undefined
2 parents 0a315a5 + 6cddf32 commit 206ac4b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/Marker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export class Marker extends React.Component {
2626
componentDidUpdate(prevProps) {
2727
if ((this.props.map !== prevProps.map) ||
2828
(this.props.position !== prevProps.position)) {
29-
this.marker.setMap(null);
29+
if (this.marker) {
30+
this.marker.setMap(null);
31+
}
3032
this.renderMarker();
3133
}
3234
}

0 commit comments

Comments
 (0)