Avoid a crash with zero-sized background images. Fix #217.