Skip to content

Commit

Permalink
Mirror: avoir crash
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay committed Sep 29, 2021
1 parent 9d32c9b commit 0d69b7c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Mirror/Mirror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,19 @@ class PixelMirrorer

PIX *dstPix = (PIX *) getDstPixelAddress(procWindow.x1, dsty);
assert(dstPix);
if (!dstPix) {
continue;
}

int srcy = flip ? (_yoff - dsty) : dsty;

assert( !( (srcy < _srcBounds.y1) || (_srcBounds.y2 <= srcy) || (_srcBounds.y2 <= _srcBounds.y1) ) );

const PIX *srcPix = (const PIX *) getSrcPixelAddress(srcx1, srcy);
assert(srcPix);
if (flop) {
if (!srcPix) {
std::memset( dstPix, 0, sizeof(PIX) * nComponents * (procWindow.x2 - procWindow.x1) );
} else if (flop) {
for (int x = procWindow.x1; x < procWindow.x2; ++x, dstPix += nComponents, srcPix -= nComponents) {
std::copy(srcPix, srcPix + nComponents, dstPix);
}
Expand Down

0 comments on commit 0d69b7c

Please sign in to comment.