mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Handle absent change during invite.
This commit is contained in:
committed by
Greyson Parrelli
parent
4712833853
commit
297a7d0ef8
@@ -88,8 +88,8 @@ public final class DecryptedGroupUtil {
|
||||
/**
|
||||
* The UUID of the member that made the change.
|
||||
*/
|
||||
public static UUID editorUuid(DecryptedGroupChange change) {
|
||||
return change != null ? UuidUtil.fromByteStringOrUnknown(change.getEditor()) : UuidUtil.UNKNOWN_UUID;
|
||||
public static Optional<UUID> editorUuid(DecryptedGroupChange change) {
|
||||
return Optional.fromNullable(change != null ? UuidUtil.fromByteStringOrNull(change.getEditor()) : null);
|
||||
}
|
||||
|
||||
public static Optional<DecryptedMember> findMemberByUuid(Collection<DecryptedMember> members, UUID uuid) {
|
||||
|
||||
@@ -63,11 +63,6 @@ public final class UuidUtil {
|
||||
return parseOrNull(bytes.toByteArray());
|
||||
}
|
||||
|
||||
public static UUID fromByteStringOrUnknown(ByteString bytes) {
|
||||
UUID uuid = parseOrNull(bytes.toByteArray());
|
||||
return uuid != null ? uuid : UNKNOWN_UUID;
|
||||
}
|
||||
|
||||
private static UUID parseOrNull(byte[] byteArray) {
|
||||
return byteArray != null && byteArray.length == 16 ? parseOrThrow(byteArray) : null;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public final class DecryptedGroupUtilTest {
|
||||
.setEditor(editor)
|
||||
.build();
|
||||
|
||||
UUID parsed = DecryptedGroupUtil.editorUuid(groupChange);
|
||||
UUID parsed = DecryptedGroupUtil.editorUuid(groupChange).get();
|
||||
|
||||
assertEquals(uuid, parsed);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user