Skip to content

Commit b2d2869

Browse files
authored
fix null pointer when infoWindow with altitude (#1428)
1 parent 4b3e0e6 commit b2d2869

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ui/InfoWindow.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { isString } from '../core/util';
22
import { createEl, addDomEvent, removeDomEvent } from '../core/util/dom';
33
import Point from '../geo/Point';
4+
import Size from '../geo/Size';
45
import { Geometry, Marker, MultiPoint, LineString, MultiLineString } from '../geometry';
56
import UIComponent from './UIComponent';
67

@@ -30,6 +31,8 @@ const options = {
3031
'content': null
3132
};
3233

34+
const EMPTY_SIZE = new Size(0, 0);
35+
3336
/**
3437
* @classdesc
3538
* Class for info window, a popup on the map to display any useful infomation you wanted.
@@ -202,6 +205,9 @@ class InfoWindow extends UIComponent {
202205
painter = children[0]._getPainter();
203206
markerSize = children[0].getSize();
204207
}
208+
if (!markerSize) {
209+
markerSize = EMPTY_SIZE;
210+
}
205211
if (painter) {
206212
const fixExtent = painter.getFixedExtent();
207213
o._add(fixExtent.xmax - markerSize.width / 2, fixExtent.ymin);

0 commit comments

Comments
 (0)