Commit cc273e49 authored by Agata Cacko's avatar Agata Cacko

Fix crash on curve adjustment filter in CMYK document

Before this commit, Krita will crash on accessing Saturation
or other "fake" channel in the curve adjustment filter dialog.
This commit fixes it.
The problem was in recent change in the PerChannelFilter,
it would access the actual channels of the color space
to set min and max of the dialog. Since Saturation isn't
a channel of the CMYK color space, it would crash.

I'm not 100% sure the code here doesn't have any more
issues but I don't know how it exactly should be written.
In any case, this commit improves the situation by setting min
and max manually in case of "fake" channels. This is consistent
with the old behaviour before dffa0760.

BUG:424187
parent 4382191b
......@@ -102,8 +102,16 @@ void KisPerChannelConfigWidget::updateChannelControls()
default:
//Hack Alert: should be changed to float
if (m_dev->colorSpace()->colorModelId() == LABAColorModelID || m_dev->colorSpace()->colorModelId() == CMYKAColorModelID) {
min = m_dev->colorSpace()->channels()[m_activeVChannel]->getUIMin();
max = m_dev->colorSpace()->channels()[m_activeVChannel]->getUIMax();
if (m_dev->colorSpace()->channels().length() > m_activeVChannel) {
min = m_dev->colorSpace()->channels()[m_activeVChannel]->getUIMin();
max = m_dev->colorSpace()->channels()[m_activeVChannel]->getUIMax();
} else {
// it must be "Hue", "Saturation" or other "channel" that isn't actually accessible in the color space
min = 0;
// specific number apparently doesn't matter,
// if there is 255, it will work just fine, too
max = 100;
}
} else {
min = 0;
max = 100;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment