Prevent potential NPE in ProfileSelectionHandler

Change-Id: I00c5e42603f94a6731d41d1374bc7c07a12170dd
Signed-off-by: Fred Bricon <fbricon@gmail.com>
diff --git a/org.eclipse.m2e.profiles.ui/src/org/eclipse/m2e/profiles/ui/internal/actions/ProfileSelectionHandler.java b/org.eclipse.m2e.profiles.ui/src/org/eclipse/m2e/profiles/ui/internal/actions/ProfileSelectionHandler.java
index bc50738..5f36791 100644
--- a/org.eclipse.m2e.profiles.ui/src/org/eclipse/m2e/profiles/ui/internal/actions/ProfileSelectionHandler.java
+++ b/org.eclipse.m2e.profiles.ui/src/org/eclipse/m2e/profiles/ui/internal/actions/ProfileSelectionHandler.java
@@ -212,14 +212,16 @@
 
       // Init the smallest profiles selection possible
       List<ProfileSelection> selection = new ArrayList<ProfileSelection>();
-      for(ProfileData p : currentSelection) {
-        ProfileSelection ps = new ProfileSelection();
-        ps.setId(p.getId());
-        ps.setActivationState(p.getActivationState());
-        ps.setAutoActive(p.isAutoActive());
-        ps.setSource(p.getSource());
-        ps.setSelected(p.isUserSelected());
-        selection.add(ps);
+      if(currentSelection != null) {
+        for(ProfileData p : currentSelection) {
+          ProfileSelection ps = new ProfileSelection();
+          ps.setId(p.getId());
+          ps.setActivationState(p.getActivationState());
+          ps.setAutoActive(p.isAutoActive());
+          ps.setSource(p.getSource());
+          ps.setSelected(p.isUserSelected());
+          selection.add(ps);
+        }
       }
 
       if(!projectProfiles.isEmpty()) {