Commit de3c8295 authored by David Edmundson's avatar David Edmundson
Browse files

[pocreator] Avoid divide by 0

Summary:
If a po file has no strings, the current code will divide by 0 when
trying to draw some pie charts.

This patch aborts early which falls back to a regular icon.

BUG: 412585

Test Plan:
touch empty.po
open dolphin in cwd

Reviewers: ngraham

Reviewed By: ngraham

Subscribers: ngraham

Differential Revision: https://phabricator.kde.org/D24984
parent 0523400b
......@@ -119,6 +119,11 @@ bool PoCreator::create( const QString& path, int width, int height, QImage& img
int total = translate + untranslate + fuzzy + obsolete;
if (total == 0) {
// Treat a .po file with no strings as an invalid file
return false;
}
int d = ( width < height ) ? width - 2 : height - 2;
QImage pix( d + 2, d + 2, QImage::Format_ARGB32_Premultiplied );
......
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