1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Fix bug caused by edge case of Math.abs()

This commit is contained in:
cketti 2015-01-03 03:04:44 +01:00
parent 928c7f33a3
commit 65d2de0fcc

View File

@ -156,8 +156,8 @@ public class ContactPictureLoader {
} }
int val = address.hashCode(); int val = address.hashCode();
int rgb = CONTACT_DUMMY_COLORS_ARGB[Math.abs(val) % CONTACT_DUMMY_COLORS_ARGB.length]; int colorIndex = (val & Integer.MAX_VALUE) % CONTACT_DUMMY_COLORS_ARGB.length;
return rgb; return CONTACT_DUMMY_COLORS_ARGB[colorIndex];
} }
private String calcUnknownContactLetter(Address address) { private String calcUnknownContactLetter(Address address) {