[scene] Avoid a crash when currentPixmap is invalid and previousPixmap is null or invalid

This commit is contained in:
Méven Car 2020-06-02 09:54:55 +02:00
parent 051cba15ce
commit 1a50c98f4a

View file

@ -670,11 +670,13 @@ template <typename T>
inline inline
T *Scene::Window::windowPixmap() const T *Scene::Window::windowPixmap() const
{ {
if (m_currentPixmap->isValid()) { if (m_currentPixmap && m_currentPixmap->isValid()) {
return static_cast<T*>(m_currentPixmap.data()); return static_cast<T*>(m_currentPixmap.data());
} else { }
if (m_previousPixmap && m_previousPixmap->isValid()) {
return static_cast<T*>(m_previousPixmap.data()); return static_cast<T*>(m_previousPixmap.data());
} }
return nullptr;
} }
template <typename T> template <typename T>