Added a null checking to prevent a JavaModelException caused by null references