mapbox/mapbox-gl-js

validate property names in getPaintProperty

Open

#6033 aperta il 22 gen 2018

Vedi su GitHub
 (2 commenti) (5 reazioni) (0 assegnatari)JavaScript (2203 fork)batch import
api :memo:good first issue

Metriche repository

Star
 (10.532 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

map.setPaintProperty(layer, key value) validates arguments but map.getPaintProperty does not. Providing a bad property key will trigger an internal error. It should trigger an error with a helpful errror message. Seen here: https://github.com/mapbox/mapbox-gl-js/issues/6030

mapbox-gl-js version: v0.43.0 and master

Steps to Trigger Behavior

  1. map.getPaintProperty("background", "fill-radius");

Expected Behavior

something like: "fill-radius" is not a paint property background layers"

Actual Behavior

Uncaught TypeError: Cannot read property 'value' of undefined

Guida contributor