@@ -4337,7 +4337,7 @@ int Config::getNumDisplaysAll() const noexcept
43374337
43384338const char * Config::getDisplayAll (int index) const noexcept
43394339{
4340- if (index >= 0 || index < static_cast <int >(getImpl ()->m_displays .size ()))
4340+ if (index >= 0 && index < static_cast <int >(getImpl ()->m_displays .size ()))
43414341 {
43424342 return getImpl ()->m_displays [index].first .c_str ();
43434343 }
@@ -4365,7 +4365,7 @@ int Config::getDisplayAllByName(const char * name) const noexcept
43654365
43664366bool Config::isDisplayTemporary (int index) const noexcept
43674367{
4368- if (index >= 0 || index < static_cast <int >(getImpl ()->m_displays .size ()))
4368+ if (index >= 0 && index < static_cast <int >(getImpl ()->m_displays .size ()))
43694369 {
43704370 return getImpl ()->m_displays [index].second .m_temporary ;
43714371 }
@@ -4375,7 +4375,7 @@ bool Config::isDisplayTemporary(int index) const noexcept
43754375
43764376void Config::setDisplayTemporary (int index, bool isTemporary) noexcept
43774377{
4378- if (index >= 0 || index < static_cast <int >(getImpl ()->m_displays .size ()))
4378+ if (index >= 0 && index < static_cast <int >(getImpl ()->m_displays .size ()))
43794379 {
43804380 getImpl ()->m_displays [index].second .m_temporary = isTemporary;
43814381
@@ -4410,7 +4410,7 @@ const char * Config::getView(ViewType type, const char * display, int index) con
44104410{
44114411 if (!display || !*display)
44124412 {
4413- if (index >= 0 || index < static_cast <int >(getImpl ()->m_sharedViews .size ()))
4413+ if (index >= 0 && index < static_cast <int >(getImpl ()->m_sharedViews .size ()))
44144414 {
44154415 return getImpl ()->m_sharedViews [index].m_name .c_str ();
44164416 }
@@ -4449,11 +4449,19 @@ const char * Config::getView(ViewType type, const char * display, int index) con
44494449
44504450void Config::getDefaultLumaCoefs (double * c3) const
44514451{
4452+ if (!c3)
4453+ {
4454+ throw Exception (" getDefaultLumaCoefs: c3 must not be null." );
4455+ }
44524456 memcpy (c3, &getImpl ()->m_defaultLumaCoefs [0 ], 3 *sizeof (double ));
44534457}
44544458
44554459void Config::setDefaultLumaCoefs (const double * c3)
44564460{
4461+ if (!c3)
4462+ {
4463+ throw Exception (" setDefaultLumaCoefs: c3 must not be null." );
4464+ }
44574465 memcpy (&getImpl ()->m_defaultLumaCoefs [0 ], c3, 3 *sizeof (double ));
44584466
44594467 AutoMutex lock (getImpl ()->m_cacheidMutex );
0 commit comments