Skip to content
Snippets Groups Projects
Unverified Commit d9b78648 authored by Christoph Wurst's avatar Christoph Wurst Committed by GitHub
Browse files

Merge pull request #3107 from nextcloud/fix/important-messages-extractor-div-by-zero

Fix div by zero in important messages feature extractor
parents aca8c544 a899b6b3
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,10 @@ class ImportantMessagesExtractor implements IExtractor {
}
public function extract(string $email): float {
return ($this->flaggedMessages[$email] ?? 0) / ($this->totalMessages[$email] ?? 0);
if (($total = $this->totalMessages[$email] ?? 0) === 0) {
// Prevent div by 0
return 0;
}
return ($this->flaggedMessages[$email] ?? 0) / $total;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment