I have such condition
// `xyz` is a `dictionary<string, MyCustomType>`.
if(smth){
xyz["ord_82"] = Func() ;// That Returns "MyCustomType" object
}
if(xyz.ContainsKey("ord_82"){
Print("started");
Print(xyz["ord_82"].ToString()); // <---------------- sometimes this line throws "Object reference not set to an instance of an object"
Print("ended");
}
I couldnt find out what could be the reason.. You see, that ContainsKey
is passed, but still throws an error..