Fixed crash

pull/187/head 1.1344
M66B 4 years ago
parent 4e5a16c23e
commit 848dc980d0

@ -12,8 +12,8 @@ android {
applicationId "eu.faircode.email" applicationId "eu.faircode.email"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 30
versionCode 1343 versionCode 1344
versionName "1.1343" versionName "1.1344"
archivesBaseName = "FairEmail-v$versionName" archivesBaseName = "FairEmail-v$versionName"
// https://en.wikipedia.org/wiki/List_of_dinosaur_genera // https://en.wikipedia.org/wiki/List_of_dinosaur_genera

@ -4507,16 +4507,24 @@ public class FragmentCompose extends FragmentBase {
checkAddress(acc, context); checkAddress(acc, context);
checkAddress(abcc, context); checkAddress(abcc, context);
List<String> all = new ArrayList<>(); List<InternetAddress> check = new ArrayList<>();
List<String> checked = new ArrayList<>();
List<String> dup = new ArrayList<>(); List<String> dup = new ArrayList<>();
for (InternetAddress a : Helper.concat(Helper.concat(ato, acc), abcc)) { if (ato != null)
check.addAll(Arrays.asList(ato));
if (acc != null)
check.addAll(Arrays.asList(acc));
if (abcc != null)
check.addAll(Arrays.asList(abcc));
for (InternetAddress a : check) {
String email = a.getAddress(); String email = a.getAddress();
if (TextUtils.isEmpty(email)) if (TextUtils.isEmpty(email))
continue; continue;
if (all.contains(a.getAddress())) if (checked.contains(a.getAddress()))
dup.add(email); dup.add(email);
else else
all.add(email); checked.add(email);
} }
if (dup.size() > 0) if (dup.size() > 0)

@ -1564,17 +1564,6 @@ public class Helper {
return result; return result;
} }
@SuppressWarnings("unchecked")
public static <T> T[] concat(T[] a, T[] b) {
if (a == null)
a = (T[]) new Object[0];
if (b == null)
b = (T[]) new Object[0];
T[] both = Arrays.copyOf(a, a.length + b.length);
System.arraycopy(b, 0, both, a.length, b.length);
return both;
}
static boolean equal(String[] a1, String[] a2) { static boolean equal(String[] a1, String[] a2) {
if (a1 == null && a2 == null) if (a1 == null && a2 == null)
return true; return true;

Loading…
Cancel
Save