mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-22 07:57:30 +00:00
Fix for occasional NPE
This commit is contained in:
parent
575341704e
commit
0e5ff9bdac
@ -25,10 +25,11 @@ import org.thoughtcrime.securesms.R;
|
|||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
import org.thoughtcrime.securesms.util.NumberUtil;
|
import org.thoughtcrime.securesms.util.NumberUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
@ -54,8 +55,11 @@ public class RecipientFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Recipients getRecipientsForIds(Context context, String recipientIds) {
|
public static Recipients getRecipientsForIds(Context context, String recipientIds) {
|
||||||
ArrayList<Recipient> results = new ArrayList<Recipient>();
|
if (recipientIds == null || recipientIds.trim().length() == 0)
|
||||||
StringTokenizer tokenizer = new StringTokenizer(recipientIds.trim(), " ");
|
return new Recipients(new LinkedList<Recipient>());
|
||||||
|
|
||||||
|
List<Recipient> results = new LinkedList<Recipient>();
|
||||||
|
StringTokenizer tokenizer = new StringTokenizer(recipientIds.trim(), " ");
|
||||||
|
|
||||||
while (tokenizer.hasMoreTokens()) {
|
while (tokenizer.hasMoreTokens()) {
|
||||||
String recipientId = tokenizer.nextToken();
|
String recipientId = tokenizer.nextToken();
|
||||||
@ -87,8 +91,8 @@ public class RecipientFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Recipients getRecipientsFromString(Context context, String rawText) throws RecipientFormattingException {
|
public static Recipients getRecipientsFromString(Context context, String rawText) throws RecipientFormattingException {
|
||||||
ArrayList<Recipient> results = new ArrayList<Recipient>();
|
List<Recipient> results = new LinkedList<Recipient>();
|
||||||
StringTokenizer tokenizer = new StringTokenizer(rawText, ",");
|
StringTokenizer tokenizer = new StringTokenizer(rawText, ",");
|
||||||
|
|
||||||
while (tokenizer.hasMoreTokens()) {
|
while (tokenizer.hasMoreTokens()) {
|
||||||
Recipient recipient = parseRecipient(context, tokenizer.nextToken());
|
Recipient recipient = parseRecipient(context, tokenizer.nextToken());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user