code: function() {
        ctx.options.styles.forEach(style => {
          if (ctx.map.getLayer(style.id)) {
            ctx.map.removeLayer(style.id);
          }
        });
  
        if (ctx.map.getSource(Constants.sources.COLD)) {
          ctx.map.removeSource(Constants.sources.COLD);
        }
  
        if (ctx.map.getSource(Constants.sources.HOT)) {
          ctx.map.removeSource(Constants.sources.HOT);
        }
      }
docs: Check for layers and sources before attempting to remove If user adds draw control and removes it before the map is loaded, layers and sources will be missing