Welcome to the community!
When you receive the Nullpointer exception during identity changes and refresh tasks, it could most possibly due to the IdentityAttribute or IdentityAttributeTarget rules that are set in your environment.
Please take a look on these rules and verify if there is a code which is calling a method on a null object.