Skip to content

Commit

Permalink
Don't crash if image anchor is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj committed Nov 7, 2018
1 parent 264a271 commit 627640c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/olcs/FeatureConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,10 +718,10 @@ class FeatureConverter {
});

if (imageStyle instanceof olStyleIcon) {
bbOptions.pixelOffset = new Cesium.Cartesian2(
image.width / 2 - imageStyle.getAnchor()[0],
image.height / 2 - imageStyle.getAnchor()[1]
);
const anchor = imageStyle.getAnchor();
if (anchor) {
bbOptions.pixelOffset = new Cesium.Cartesian2(image.width / 2 - anchor[0], image.height / 2 - anchor[1]);
}
}

const bb = this.csAddBillboard(billboards, bbOptions, layer, feature, olGeometry, style);
Expand Down

0 comments on commit 627640c

Please sign in to comment.