Fix crash with null image