Project

General

Profile

« Previous | Next » 

Revision 102e44cd

Added by Patrick Plitzner over 7 years ago

Fix potential NPE

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaMetaElement.java
5 5

  
6 6
import java.util.Map;
7 7

  
8
import org.apache.commons.lang.StringUtils;
9 8
import org.eclipse.jface.action.IAction;
10
import org.eclipse.swt.SWT;
11 9
import org.eclipse.swt.events.SelectionAdapter;
12 10
import org.eclipse.swt.events.SelectionEvent;
13 11
import org.eclipse.swt.events.SelectionListener;
14 12
import org.eclipse.swt.widgets.Button;
15
import org.eclipse.swt.widgets.Event;
16
import org.eclipse.swt.widgets.Listener;
17 13

  
14
import eu.etaxonomy.cdm.common.CdmUtils;
18 15
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
19 16
import eu.etaxonomy.cdm.model.agent.AgentBase;
20 17
import eu.etaxonomy.cdm.model.common.Language;
......
32 29
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
33 30
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
34 31
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
35
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
36 32
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
37 33

  
38 34
/**
......
87 83
        this.entity = element;
88 84
        mediaDetailElement.setEntity(element);
89 85

  
90
        selection_artist.setEntity((AgentBase<?>) HibernateProxyHelper
86
        selection_artist.setEntity(HibernateProxyHelper
91 87
                .deproxy(element.getArtist()));
92 88

  
93 89
        text_description.setLanguageString(element.getDescription(CdmStore
94 90
                .getDefaultLanguage()));
95
        if (text_description.getText().isEmpty()){
91
        if (CdmUtils.isBlank(text_description.getText())){
96 92
        	Map<Language, LanguageString> allDescriptions = element.getAllDescriptions();
97 93
        	if (!allDescriptions.isEmpty()){
98 94
        		text_description.setLanguageString(allDescriptions.get(Language.ENGLISH()));

Also available in: Unified diff