Li Ke which method are you intending to refactor?
If it is inside the git plugin (as in GitStatus or GitSCMSource), then your refactoring must include many tests to show current behavior. Once you have tests that cover current behavior, then the refactoring can be attempted with the benefit of the tests to catch unexpected breaks. With 120 000+ installations, there are very few branches in the git plugin which are not required for someone.
If it is inside core Jenkins, others will need to decide if it needs tests first, or already has sufficient tests. I've consistently found that there are not enough tests in the git plugin (and the git client plugin).
I'm not especially persuaded that a null pointer exception in one of the triggers should be ignored. That seems like we've detected undefined behavior, but will silently ignore it and continue operation.