Skip to content

Commit

Permalink
'#1880: More robust WAContact constructor (handle id="123@").
Browse files Browse the repository at this point in the history
  • Loading branch information
wladimirleite committed Sep 15, 2023
1 parent ef18f22 commit 85e576c
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ public class WAContact {
private boolean deleted = false;

public WAContact(String id) {
if (id != null && id.contains("@")) { //$NON-NLS-1$
String[] id_split = id.split("@"); //$NON-NLS-1$
this.id = id_split[0];
this.suffix = id_split[1];
if (id != null) {
String[] idSplit = id.split("@", 2);
this.id = idSplit[0];
this.suffix = idSplit.length > 1 ? idSplit[1] : "";
} else {
this.id = id;
this.suffix = ""; //$NON-NLS-1$
this.id = this.suffix = "";
}
}

Expand Down

0 comments on commit 85e576c

Please sign in to comment.