diff --git a/src/sst/jucegui/components/VSlider.cpp b/src/sst/jucegui/components/VSlider.cpp index e1932f3..7ce123b 100644 --- a/src/sst/jucegui/components/VSlider.cpp +++ b/src/sst/jucegui/components/VSlider.cpp @@ -88,14 +88,18 @@ void VSlider::paint(juce::Graphics &g) auto hr = juce::Rectangle(2 * hanRadius, 2 * hanRadius).withCentre(hc); - auto mvplus = std::clamp(v + continuousModulatable()->getModulationValuePM1(), 0.f, 1.f); - auto mvminus = std::clamp(v - continuousModulatable()->getModulationValuePM1(), 0.f, 1.f); - auto hm = (1.0 - mvplus) * gutter.getHeight(); - auto mpc = gutter.withTrimmedTop(hm).withHeight(1).expanded(0, 4).getCentre(); - auto mpr = juce::Rectangle(2 * hanRadius, 2 * hanRadius).withCentre(mpc); + juce::Point mpc; + juce::Rectangle mpr; - if (isEditingMod) + + if (continuousModulatable() && isEditingMod) { + auto mvplus = std::clamp(v + continuousModulatable()->getModulationValuePM1(), 0.f, 1.f); + auto mvminus = std::clamp(v - continuousModulatable()->getModulationValuePM1(), 0.f, 1.f); + auto hm = (1.0 - mvplus) * gutter.getHeight(); + mpc = gutter.withTrimmedTop(hm).withHeight(1).expanded(0, 4).getCentre(); + mpr = juce::Rectangle(2 * hanRadius, 2 * hanRadius).withCentre(mpc); + // draw rules { auto t = hc.getY();