screenshot: do not segfault when taking a window picture with no delay

Taken from
https://git.gnome.org/browse/archive/gnome-utils/commit/?id=18a88aa628382382e5aa22bb45752e7bd0c0bfee