vaadin / addressbook

Simple Addressbook example application
91 stars 1.13k forks source link

Possible NPE in ContactService #15

Open s1ac2x1 opened 9 years ago

s1ac2x1 commented 9 years ago

The following comparator may throw NPE in cases when Contact's ID hasn't been set:

    Collections.sort(arrayList, new Comparator<Contact>() {
        @Override
        public int compare(Contact o1, Contact o2) {
            return (int) (o2.getId() - o1.getId());
        }
    });