Fix exception when attachment couldn't be read.