I tried checking for null but the compiler warns that this condition will never occur. What should I be looking for?
ContainsKey is what you're looking for.