Looking at the code around the NPE, it seems that somehow the eclipse 'IProject' instance ends up being 'null'. The project is being determined based on its location on disk, looking for a project in the workspace with that location.
Without being able to reproduce it I have limited information about why the project is not found.
One possibility that comes to mind is that for some reason the project's 'getLocation' method may be returning 'null'. This is unusual, but according to the eclipse api docs it is possible
If this resource is a project that exists in the workspace, this method returns the path to the project's local content area. This is true regardless of whether the project is open or closed. This value will be null in the case where the location is relative to an undefined workspace path variable.