Prevent dictionary crashers when keys are null

Adds some protection against sloppy coding on the client side.