Consider empty usernames as absent.

This commit is contained in:
Greyson Parrelli
2023-11-02 16:07:54 -04:00
parent 528e301ce4
commit f1dccbb64d
2 changed files with 2 additions and 2 deletions

View File

@@ -666,7 +666,7 @@ public class Recipient {
public @NonNull Optional<String> getUsername() {
if (FeatureFlags.usernames()) {
return Optional.ofNullable(username);
return OptionalUtil.absentIfEmpty(username);
} else {
return Optional.empty();
}

View File

@@ -32,7 +32,7 @@ object OptionalUtil {
@JvmStatic
fun absentIfEmpty(value: String?): Optional<String> {
return if (value == null || value.isEmpty()) {
return if (value.isNullOrEmpty()) {
Optional.empty()
} else {
Optional.of(value)