diff options
| author | jacob1 <jfu614@gmail.com> | 2013-04-10 03:40:18 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-04-10 03:40:18 (GMT) |
| commit | 3b7e4186283605a0c791811200e505bf9eeae886 (patch) | |
| tree | 8bd888bba6d2ef288cc40e55867191c1b9b3e83a /src/graphics/Graphics.cpp | |
| parent | 602cbf07015577efd865289b95e842ad118cf084 (diff) | |
| download | powder-3b7e4186283605a0c791811200e505bf9eeae886.zip powder-3b7e4186283605a0c791811200e505bf9eeae886.tar.gz | |
fix assert error when resampling an image to an invalid size (corrupted stamps)
Diffstat (limited to 'src/graphics/Graphics.cpp')
| -rw-r--r-- | src/graphics/Graphics.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp index b948189..bacb421 100644 --- a/src/graphics/Graphics.cpp +++ b/src/graphics/Graphics.cpp @@ -344,6 +344,8 @@ pixel *Graphics::resample_img(pixel *src, int sw, int sh, int rw, int rh) float * samples[PIXELCHANNELS]; //Resampler for each colour channel + if (sourceWidth <= 0 || sourceHeight <= 0 || resultWidth <= 0 || resultHeight <= 0) + return NULL; resamplers[0] = new Resampler(sourceWidth, sourceHeight, resultWidth, resultHeight, Resampler::BOUNDARY_CLAMP, 0.0f, 1.0f, pFilter, NULL, NULL, filter_scale, filter_scale); samples[0] = new float[sourceWidth]; for (int i = 1; i < PIXELCHANNELS; i++) |
