Fix PNI crash in in group processing.

This commit is contained in:
Cody Henthorne
2022-05-12 16:11:44 -04:00
committed by Alex Hart
parent dc095c9db4
commit 9bc4dfc3f6
4 changed files with 10 additions and 8 deletions

View File

@@ -111,8 +111,8 @@ internal class AccountValues internal constructor(store: KeyValueStore) : Signal
putString(KEY_PNI, pni.toString())
}
fun requireServiceIds(): ServiceIds {
return ServiceIds(requireAci(), requirePni())
fun getServiceIds(): ServiceIds {
return ServiceIds(requireAci(), pni)
}
/** The local user's E164. */

View File

@@ -10,13 +10,13 @@ import java.util.UUID
* Helper for dealing with [ServiceId] matching when you only care that either of your
* service ids match but don't care which one.
*/
data class ServiceIds(val aci: ACI, val pni: PNI) {
data class ServiceIds(val aci: ACI, val pni: PNI?) {
private val aciByteString: ByteString by lazy { UuidUtil.toByteString(aci.uuid()) }
private val pniByteString: ByteString by lazy { UuidUtil.toByteString(pni.uuid()) }
private val pniByteString: ByteString? by lazy { pni?.let { UuidUtil.toByteString(it.uuid()) } }
fun matches(uuid: UUID): Boolean {
return uuid == aci.uuid() || uuid == pni.uuid()
return uuid == aci.uuid() || uuid == pni?.uuid()
}
fun matches(uuid: ByteString): Boolean {