Project

General

Profile

« Previous | Next » 

Revision 9fbee850

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
303 303
			public int compare(UuidAndTitleCache entity1,
304 304
					UuidAndTitleCache entity2) {
305 305
				Collator collator = Collator.getInstance();
306
				if (entity1.getUuid().equals(entity2.getUuid())){
306
				if (entity1 == entity2){
307 307
				    return 0;
308 308
				}
309

  
310
				if (entity1 == null && entity2 != null){
311
				    return -1;
312
				}
313
				if (entity2 == null && entity1 != null){
314
				    return 1;
315
				}
316
				if (entity1.getUuid().equals(entity2.getUuid())){
317
                    return 0;
318
                }
319
				if (entity1.getTitleCache() == null && entity2.getTitleCache() != null){
320
				    return -1;
321
				}
322
				if (entity2.getTitleCache() == null){
323
				    return 1;
324
				}
309 325
				int result = collator.compare(entity1.getTitleCache(), entity2.getTitleCache());
310 326
				if (result == 0){
311 327
				    result = entity1.getUuid().compareTo(entity2.getUuid());

Also available in: Unified diff