Sonar fix NullPointerException