fix: Do not crash when adding a watchtower alert for a missing cipher item
This commit is contained in:
parent
f8c77ea34d
commit
67ace9692d
|
@ -145,14 +145,18 @@ private class WatchtowerClient(
|
||||||
val results = processor.process(ciphers)
|
val results = processor.process(ciphers)
|
||||||
db.transaction {
|
db.transaction {
|
||||||
results.forEach { r ->
|
results.forEach { r ->
|
||||||
db.watchtowerThreatQueries.upsert(
|
// We might be inserting a threat report on a cipher that
|
||||||
value = r.value,
|
// does not exist anymore. This is fine, just ignore it.
|
||||||
threat = r.threat && !r.cipher.deleted,
|
runCatching {
|
||||||
cipherId = r.cipher.id,
|
db.watchtowerThreatQueries.upsert(
|
||||||
type = type,
|
value = r.value,
|
||||||
reportedAt = now,
|
threat = r.threat && !r.cipher.deleted,
|
||||||
version = version,
|
cipherId = r.cipher.id,
|
||||||
)
|
type = type,
|
||||||
|
reportedAt = now,
|
||||||
|
version = version,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue