-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Add nullcheck for linkedGoods #193
Conversation
Any idea why |
I'm unable to say, i was clicking around and adding a lot of recipes, changing fuels, changing links etc. Using both left click, right click, ctr+click. And i have a memory of a frog sometimes so i couldn't reproduce it. |
As we don't know the reason behind the linkedGoods being null, I suggest to add a logger in addition to the current changes. Let it write all relevant info to the file and show a warning similar to the error message when in the debug mode. This way, you or other devs will eventually collect enough info to understand the reason behind the error. |
It seems to be an issue that YaFC is running multiple threads, and sometimes modifications are made to the items it is already iterating over. (This also returned the previous mentioned freeze in #192) I just got a similar but different error than last time while trying to reproduce it. |
Random idea: But did we already run multiple threads like this at or before update 0.7.0? |
Eeeh, stupid question, do we log with Debug.WriteLine or Console.Writeline? I dont think we've ever made work of adding ILogger to the system. |
My idea was to log both in the console and the file. |
Also, i've verified my fix works, do we still need the log line? I can put it on my list to give the logger a swing, but i got at most an hour tomorrow to hack away at it so idk if i can get anything done in that department. |
I suggest to add at least the logging that you mentioned in your prevoius message, with the comment that this type of logging is not set in stone. |
9aa5021
to
0adab5e
Compare
Done 👍 |
While using YaFC-CE today i ran into an exception because
linkedGoods
insummer.TryGetValue(linkedGoods, ...)
was null. This fixed that.It's kinda a blind fix since i have no steps to reproduce, YaFC was hanging right after the exception message (i made another issue for that). But judging the code this should work.