Check the image property for validity before setting