Skip to content

Commit

Permalink
Fix NPE on import when no patient is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
muuki88 committed May 18, 2012
1 parent 2b0ea0e commit a50482b
Showing 1 changed file with 6 additions and 7 deletions.
Expand Up @@ -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();
}
Expand Down

0 comments on commit a50482b

Please sign in to comment.