X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Frotzoomer.c;h=29a566275445ae07a6e70bacd5698a057e9bae53;hp=52b382f629d7298d5f0f9e64d936660876150581;hb=07faf451b99879183ed7e909e43a0e065be1ee7f;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439 diff --git a/hacks/rotzoomer.c b/hacks/rotzoomer.c index 52b382f6..29a56627 100644 --- a/hacks/rotzoomer.c +++ b/hacks/rotzoomer.c @@ -176,8 +176,8 @@ reset_zoom (struct state *st, struct zoom_area *za) za->ww = st->width - za->w; za->hh = st->height - za->h; - za->x = (random() % za->ww); - za->y = (random() % za->hh); + za->x = (za->ww ? random() % za->ww : 0); + za->y = (za->hh ? random() % za->hh : 0); za->dx = ((2 * (random() & 1)) - 1) * (100 + random() % 300); za->dy = ((2 * (random() & 1)) - 1) * (100 + random() % 300); @@ -269,8 +269,9 @@ init_hack (struct state *st) st->zoom_box[i] = create_zoom (st); } - memcpy (st->buffer_map->data, st->orig_map->data, - st->height * st->buffer_map->bytes_per_line); + if (st->height && st->orig_map->data) + memcpy (st->buffer_map->data, st->orig_map->data, + st->height * st->buffer_map->bytes_per_line); DisplayImage(st, 0, 0, st->width, st->height); }