I would think it'd be harmless to your ears. I think there's a point where the occlusion effect can be harmful but I don't think just bumping your head can do it. I've done the same I'm sure, and also bumped earmuffs, and had loud sounds when earplugs get hit or something like that...I don't think anything ever became of it.
I think the occlusion effect is perhaps bad when you yell with earplugs in, and in some other cases...but I think bumping your head is not one them. I think the head damage would be what to watch out for, but I understand the concern.