diff options
Diffstat (limited to 'generator')
-rw-r--r-- | generator/ppmforge.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/generator/ppmforge.c b/generator/ppmforge.c index fcbbc1f1..cac56e38 100644 --- a/generator/ppmforge.c +++ b/generator/ppmforge.c @@ -493,7 +493,7 @@ createPlanetStuff(float * const a, double const bx = (n - 1) * uprj(j, cols); bxf[j] = floor(bx); - bxc[j] = bxf[j] + 1; + bxc[j] = MIN(bxf[j] + 1, n - 1); u[j] = bx - bxf[j]; u1[j] = 1 - u[j]; } @@ -1053,6 +1053,9 @@ main(int argc, char ** argv) { if ((i == argc) || (sscanf(argv[i], "%d", &meshsize) != 1)) pm_usage(usage); + if (meshsize < 2) + pm_error("mesh must be at least 2"); + /* Force FFT mesh to the next larger power of 2. */ for (j = meshsize; (j & 1) == 0; j >>= 1) ; |