Don’t start fixing code until you find reproduction steps that lead to the bug. Otherwise you can’t be sure that your fix really resolves the issue.
Write a test that will lead to that bug so you can reproduce it easily and check your fixes.
Think about the impact of your fix on functionality or try to find other bad paths, which may lead to similar error. Again, cover them with tests.