on xenial help sign in
Make sure we don't divide by 0
commit2664a82af50d37dbd8820b0ad414a46ea30277ef authorAlbert Astals <albert.astals@canonical.com> dateFri 31 Oct 2014, 15:20 (12 years ago) parent998cd29
1 file changed+8−6
plugins/Dash/croppedimagesizer.cpp+8−6
plugins/Dash/croppedimagesizer.cpp+8−6
@@ -97,12 +97,14 @@ void CroppedImageSizer::requestFinished()
9797 QImageReader m_reader(m_reply);
9898 const QSize imageSize = m_reader.size();
9999 if (imageSize.isValid()) {
100− const qreal ar = width() / height();
101− const qreal ssar = imageSize.width() / imageSize.height();
102− if (ar > ssar) {
103− m_sourceSize = QSize(m_width, 0);
104− } else {
105− m_sourceSize = QSize(0, m_height);
100+ if (m_height > 0 && imageSize.height() > 0) {
101+ const qreal ar = m_width / m_height;
102+ const qreal ssar = imageSize.width() / imageSize.height();
103+ if (ar > ssar) {
104+ m_sourceSize = QSize(m_width, 0);
105+ } else {
106+ m_sourceSize = QSize(0, m_height);
107+ }
106108 }
107109 } else {
108110 qWarning() << "Could not find size of" << m_source;