Commit 77b39d84 authored by Boudewijn Rempt's avatar Boudewijn Rempt

BUG:358137 Don't crash if Qt returns a Screen number < 0

parent 85708743
...@@ -402,9 +402,11 @@ void KisConfig::setMonitorProfile(int screen, const QString & monitorProfile, bo ...@@ -402,9 +402,11 @@ void KisConfig::setMonitorProfile(int screen, const QString & monitorProfile, bo
const KoColorProfile *KisConfig::getScreenProfile(int screen) const KoColorProfile *KisConfig::getScreenProfile(int screen)
{ {
if (screen < 0) return 0;
KisConfig cfg; KisConfig cfg;
QString monitorId; QString monitorId;
if (KisColorManager::instance()->devices().size() > screen) { if (KisColorManager::instance()->devices().size() > screen && screen > 0) {
monitorId = cfg.monitorForScreen(screen, KisColorManager::instance()->devices()[screen]); monitorId = cfg.monitorForScreen(screen, KisColorManager::instance()->devices()[screen]);
} }
//dbgKrita << "getScreenProfile(). Screen" << screen << "monitor id" << monitorId; //dbgKrita << "getScreenProfile(). Screen" << screen << "monitor id" << monitorId;
...@@ -430,6 +432,8 @@ const KoColorProfile *KisConfig::getScreenProfile(int screen) ...@@ -430,6 +432,8 @@ const KoColorProfile *KisConfig::getScreenProfile(int screen)
const KoColorProfile *KisConfig::displayProfile(int screen) const const KoColorProfile *KisConfig::displayProfile(int screen) const
{ {
if (screen < 0) return 0;
// if the user plays with the settings, they can override the display profile, in which case // if the user plays with the settings, they can override the display profile, in which case
// we don't want the system setting. // we don't want the system setting.
bool override = useSystemMonitorProfile(); bool override = useSystemMonitorProfile();
......
...@@ -399,8 +399,10 @@ void KisScratchPad::paintPresetImage() ...@@ -399,8 +399,10 @@ void KisScratchPad::paintPresetImage()
void KisScratchPad::setDisplayProfile(const KoColorProfile *colorProfile) void KisScratchPad::setDisplayProfile(const KoColorProfile *colorProfile)
{ {
m_displayProfile = colorProfile; if (colorProfile) {
QWidget::update(); m_displayProfile = colorProfile;
QWidget::update();
}
} }
void KisScratchPad::fillDefault() void KisScratchPad::fillDefault()
......
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