Avoid a NPE generating preview images