Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 0bf484f2 authored by Agata Cacko's avatar Agata Cacko Committed by Dmitry Kazakov

Explicitely return 0 instead of dividing by 0

In case of an empty rectangle it can happen that
numPixels will be 0. Better return a value than
allow undefined behaviour.
CID 248454
parent 87b74e1e
......@@ -459,6 +459,9 @@ namespace KritaUtils
}
}
if (numPixels == 0) {
return 0; // avoid dividing by 0
}
return qreal(numTransparentPixels) / numPixels;
}
......
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