Project

General

Profile

« Previous | Next » 

Revision bd46f97b

Added by Patrick Plitzner almost 7 years ago

ref #5458 Fix potential NPE

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/DetailWindow.java
16 16
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
17 17
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
18 18
import eu.etaxonomy.cdm.model.description.Distribution;
19
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
19 20
import eu.etaxonomy.cdm.model.description.StateData;
20 21
import eu.etaxonomy.cdm.model.description.TextData;
21 22
import eu.etaxonomy.cdm.model.taxon.Taxon;
......
92 93
			    tree.setParent(td, deb.getFeature());
93 94
			    tree.setChildrenAllowed(td, false);
94 95
			}else if(deb.isInstanceOf(Distribution.class)){
95
				Distribution db = CdmBase.deproxy(deb, Distribution.class);
96
				tree.addItem(db.toString());
97
				tree.setParent(db.toString(), deb.getFeature());
98
				tree.setChildrenAllowed(db.toString(), true);
99
				tree.addItem(db.getStatus().toString());
100
				tree.setParent(db.getStatus().toString(), db.toString());
101
				tree.setChildrenAllowed(db.getStatus().toString(), false);
96
			    Distribution db = CdmBase.deproxy(deb, Distribution.class);
97
			    PresenceAbsenceTerm status = db.getStatus();
98
			    if(status!=null){
99
			        tree.addItem(db.toString());
100
			        tree.setParent(db.toString(), deb.getFeature());
101
			        tree.setChildrenAllowed(db.toString(), true);
102
				    tree.addItem(status.toString());
103
				    tree.setParent(status.toString(), db.toString());
104
				    tree.setChildrenAllowed(status.toString(), false);
105
				}
102 106
			}
103 107
			tree.expandItemsRecursively(parent);
104 108
		}

Also available in: Unified diff