Will this be a no-op if there is no header? If not, it could throw,

It might be simpler to have one bigger if statement, switching on if the header exists or not.