Avoid a mysterious NPE

One user on a particular device was getting an NPE here, meaning that either the header map had a null value, or it was getting mutated in a different thread deleting a key that we expected to be there. I wasn't able to reproduce this locally, but this should protect against any eventuality.