fix occasional crash in PNMImage::quick_filter_from()

This commit is contained in:
David Rose 2017-01-04 16:28:38 -08:00
parent a757cb47e8
commit 603f0eb3b1

View File

@ -696,7 +696,7 @@ box_filter_line(const PNMImage &image,
// Get the final (partial) xel
float x_contrib = x1 - (float)x_last;
if (x_contrib > 0.0001f) {
if (x_contrib > 0.0001f && x < image.get_x_size()) {
box_filter_xel(image, x, y, x_contrib, y_contrib,
color, pixel_count);
}
@ -728,7 +728,7 @@ box_filter_region(const PNMImage &image,
// Get the final (partial) row
float y_contrib = y1 - (float)y_last;
if (y_contrib > 0.0001f) {
if (y_contrib > 0.0001f && y < image.get_y_size()) {
box_filter_line(image, x0, y, x1, y_contrib,
color, pixel_count);
}