Skip to content

Commit c79c175

Browse files
author
Joshua Daniel
committed
fix(chart): check whether JS input is function before invoking it
1 parent 3fccb15 commit c79c175

File tree

1 file changed

+6
-2
lines changed
  • superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson

1 file changed

+6
-2
lines changed

superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/Geojson.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,9 @@ export const getLayer: GetLayerType<GeoJsonLayer> = function ({
289289
if (fd.enable_labels) {
290290
if (fd.enable_label_javascript_mode) {
291291
const generator = sandboxedEval(fd.label_javascript_config_generator);
292-
labelOpts = computeGeoJsonTextOptionsFromJsOutput(generator());
292+
if (typeof generator === 'function') {
293+
labelOpts = computeGeoJsonTextOptionsFromJsOutput(generator());
294+
}
293295
} else {
294296
labelOpts = computeGeoJsonTextOptionsFromFormData(fd);
295297
}
@@ -299,7 +301,9 @@ export const getLayer: GetLayerType<GeoJsonLayer> = function ({
299301
if (fd.enable_icons) {
300302
if (fd.enable_icon_javascript_mode) {
301303
const generator = sandboxedEval(fd.icon_javascript_config_generator);
302-
iconOpts = computeGeoJsonIconOptionsFromJsOutput(generator());
304+
if (typeof generator === 'function') {
305+
iconOpts = computeGeoJsonIconOptionsFromJsOutput(generator());
306+
}
303307
} else {
304308
iconOpts = computeGeoJsonIconOptionsFromFormData(fd);
305309
}

0 commit comments

Comments
 (0)