Skip to content

Commit

Permalink
Fix conditionals
Browse files Browse the repository at this point in the history
to avoid error on destructuring a `null` value when the header is broken.
  • Loading branch information
moisseev committed Dec 10, 2019
1 parent f222b4a commit 960d516
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions chrome/content/scripts/messageHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ RspamdSpamness.Message.displayHeaders = function (update_rules) {
converter.charset = "UTF-8";
RspamdSpamness.Message.headerStr = converter.ConvertToUnicode(RspamdSpamness.Message.headerStr);

const [, s] = RspamdSpamness.Message.headerStr.match(/: \S+ \[[-\d.]+ \/ [-\d.]+\] *(.*)$/);
if (s) {
displayScoreRulesHeaders(s);
const m = RspamdSpamness.Message.headerStr.match(/: \S+ \[[-\d.]+ \/ [-\d.]+\] *(.*)$/);
if (m) {
displayScoreRulesHeaders(m[1]);
return;
}
}
Expand All @@ -149,9 +149,9 @@ RspamdSpamness.Message.displayHeaders = function (update_rules) {
// Get symbols from Exim header
[RspamdSpamness.Message.headerStr] = getHeaderBody(aMimeMsg.headers, "x-spam-report");
if (RspamdSpamness.Message.headerStr) {
const [, s] = RspamdSpamness.Message.headerStr.match(/^Action: [ a-z]+?(Symbol: .*)Message-ID:/);
if (s) {
displayScoreRulesHeaders(s);
const m = RspamdSpamness.Message.headerStr.match(/^Action: [ a-z]+?(Symbol: .*)Message-ID:/);
if (m) {
displayScoreRulesHeaders(m[1]);
return;
}
}
Expand Down

0 comments on commit 960d516

Please sign in to comment.