Permalink
Browse files

Fix NPE on import when no patient is selected

  • Loading branch information...
1 parent 2b0ea0e commit a50482b7ed364e6c442ae85db7df66d900e825d4 @muuki88 muuki88 committed May 18, 2012
@@ -87,15 +87,14 @@ public int getOption() {
* @return
*/
private void initialize() {
-
IGlobalSelectionProvider selectionProvider = GlobalSelectionProvider.newInstance(Activator.getBundleContext());
Patient selectedPatient = selectionProvider.getSelection(Patient.class);
-
- EntityManager tempEM = Activator.getEntityManagerService().createEntityManager();
- Patient mPatient = tempEM.find(Patient.class, selectedPatient.getId());
- tempEM.close();
-
- selectPatient(mPatient);
+ if(selectedPatient != null) {
+ EntityManager tempEM = Activator.getEntityManagerService().createEntityManager();
+ Patient mPatient = tempEM.find(Patient.class, selectedPatient.getId());
+ tempEM.close();
+ selectPatient(mPatient);
+ }
checkContents();
}

0 comments on commit a50482b

Please sign in to comment.