[513903]  Correct NPE when opening preference pages and no default tool profile set

Change-Id: I09c08ab4750b25d37f5db8f18ab1e76caf2263b6
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencePage.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencePage.java
index 266c098..f11112f 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencePage.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencePage.java
@@ -465,14 +465,16 @@
 			cboProfiles.removeAll();
 			for (String profileName : preferences.getAllToolProfiles(currentRuntime)) {
 				ModelEnablementDescriptor med = currentRuntime.getModelEnablements(profileName);
-				String text = med.getProfileName();
-				if (text==null || text.isEmpty())
-					text = Messages.ToolProfilePreferencePage_Unnamed + (i+1);
-				cboProfiles.add(text);
-				cboProfiles.setData(text, med);
-				if (iSelected<0 && (currentProfileName!=null && currentProfileName.equals(profileName)))
-					cboProfiles.select(iSelected = i);
-				++i;
+				if (med != null) {
+					String text = med.getProfileName();
+					if (text==null || text.isEmpty())
+						text = Messages.ToolProfilePreferencePage_Unnamed + (i+1);
+					cboProfiles.add(text);
+					cboProfiles.setData(text, med);
+					if (iSelected<0 && (currentProfileName!=null && currentProfileName.equals(profileName)))
+						cboProfiles.select(iSelected = i);
+					++i;
+				}
 			}
 			if (btnDeleteProfile!=null)
 				btnDeleteProfile.setEnabled(cboProfiles.getItemCount()>0);
@@ -865,11 +867,13 @@
 			int i=1;
 			for (String profileName : preferences.getAllToolProfiles(currentRuntime)) {
 				ModelEnablementDescriptor med = currentRuntime.getModelEnablements(profileName);
-				String text = med.getProfileName();
-				if (text==null || text.isEmpty())
-					text = Messages.ToolProfilePreferencePage_Unnamed + i++;
-				cboCopy.add(text);
-				cboCopy.setData(text, med);
+				if (med != null) {
+					String text = med.getProfileName();
+					if (text==null || text.isEmpty())
+						text = Messages.ToolProfilePreferencePage_Unnamed + i++;
+					cboCopy.add(text);
+					cboCopy.setData(text, med);
+				}
 			}
 			cboCopy.setEnabled(false);