Fix divide-by-zero crash

Authored by ngraham on Jan 8 2020, 4:23 PM.



Bug was introduced in D21398.

BUG: 414631
FIXED-IN: 19.12.2

Test Plan

Compile only and verify normal functionality only; can't reproduce the issue so can't
test the fix

Diff Detail

R260 Gwenview
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
ngraham created this revision.Jan 8 2020, 4:23 PM
Restricted Application added a project: Gwenview. · View Herald TranscriptJan 8 2020, 4:23 PM
ngraham requested review of this revision.Jan 8 2020, 4:23 PM
tommo added a subscriber: tommo.Jan 9 2020, 6:48 AM

Oh, good spot. I haven't considered malformed zero-size thumbnails, indeed.
In this case, you should also check for prevWidth > 0, otherwise scale
would become zero and we would have another div-by-zero.

ngraham updated this revision to Diff 73132.Jan 9 2020, 3:29 PM

Also check prevWidth

tommo added a comment.Jan 9 2020, 4:21 PM

LGTM, thx!

This revision was not accepted when it landed; it landed in state Needs Review.Jan 9 2020, 5:09 PM
This revision was automatically updated to reflect the committed changes.