mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-28 19:06:18 +03:00
Merge pull request #3196 from tkoeppe/avg_fix
[QuantOctree.c] Remove erroneous attempt to average over an empty range
This commit is contained in:
commit
241ea6b283
|
@ -259,6 +259,10 @@ subtract_color_buckets(ColorCube cube, ColorBucket buckets, long nBuckets) {
|
||||||
Pixel p;
|
Pixel p;
|
||||||
for (i=0; i<nBuckets; i++) {
|
for (i=0; i<nBuckets; i++) {
|
||||||
subtrahend = &buckets[i];
|
subtrahend = &buckets[i];
|
||||||
|
|
||||||
|
// If the subtrahend contains no buckets, there is nothing to subtract.
|
||||||
|
if (subtrahend->count == 0) continue;
|
||||||
|
|
||||||
avg_color_from_color_bucket(subtrahend, &p);
|
avg_color_from_color_bucket(subtrahend, &p);
|
||||||
minuend = color_bucket_from_cube(cube, &p);
|
minuend = color_bucket_from_cube(cube, &p);
|
||||||
minuend->count -= subtrahend->count;
|
minuend->count -= subtrahend->count;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user