diff --git a/modules/Slider.js b/modules/Slider.js index 198b2d0f8..856c6bed5 100644 --- a/modules/Slider.js +++ b/modules/Slider.js @@ -130,10 +130,11 @@ try { // For making it possiblie to run the test app in the following catch stat o.v.cbObj = {mode:"incr", value:incr}; } } - if (o.v.level!==o.v.prevLevel || o.v.level===0 || o.v.level===o.c.steps) { - cb(o.v.cbObj.mode, o.v.cbObj.value); // FIXME: Can cause error when using "incr" since it's not sure that o.v.cbObj has been initialized thanks to how the while-logic above works. (Can also do callback with faulty feedback since it didn't update) + if (o.v.cbObj && (o.v.level!==o.v.prevLevel||o.v.level===0||o.v.level===o.c.steps)) { + cb(o.v.cbObj.mode, o.v.cbObj.value); o.f.draw&&o.f.draw(o.v.level); } + o.v.cbObj = null; o.v.prevLevel = o.v.level; o.v.ebLast = e.b; }