Project

General

Profile

« Previous | Next » 

Revision cdc9963c

Added by Katja Luther over 6 years ago

avoid NPE in ItemsComparator of selection dialogs

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java
297 297
			public int compare(UuidAndTitleCache entity1,
298 298
					UuidAndTitleCache entity2) {
299 299
				Collator collator = Collator.getInstance();
300
				if (entity1.getUuid().equals(entity2.getUuid())){
300
				if (entity1 == entity2){
301 301
				    return 0;
302 302
				}
303

  
304
				if (entity1 == null && entity2 != null){
305
				    return -1;
306
				}
307
				if (entity2 == null && entity1 != null){
308
				    return 1;
309
				}
310
				if (entity1.getUuid().equals(entity2.getUuid())){
311
                    return 0;
312
                }
313
				if (entity1.getTitleCache() == null && entity2.getTitleCache() != null){
314
				    return -1;
315
				}
316
				if (entity2.getTitleCache() == null){
317
				    return 1;
318
				}
303 319
				int result = collator.compare(entity1.getTitleCache(), entity2.getTitleCache());
304 320
				if (result == 0){
305 321
				    result = entity1.getUuid().compareTo(entity2.getUuid());

Also available in: Unified diff