Add check to prevent crash. Refs #9208.