Bug 1462882 - Avoid NPE when filtering using remote-ip. r=jryans, a=RyanVM
authorJan Odvarko <odvarko@gmail.com>
Tue, 22 May 2018 10:34:50 +0200
changeset 806025 bd1438686c3f1c174e49c7eb5ec864b252e119e8
parent 806024 e5deb539c16d5bca2868be847a569e8f96129c73
child 806026 d7e42c12b4a70535e0a81df0f54ec13cf6263d52
push id112832
push userbballo@mozilla.com
push dateFri, 08 Jun 2018 21:11:22 +0000
reviewersjryans, RyanVM
bugs1462882
milestone60.0.3
Bug 1462882 - Avoid NPE when filtering using remote-ip. r=jryans, a=RyanVM MozReview-Commit-ID: IJ2lNgMRCYz
devtools/client/netmonitor/src/utils/filter-text-utils.js
--- a/devtools/client/netmonitor/src/utils/filter-text-utils.js
+++ b/devtools/client/netmonitor/src/utils/filter-text-utils.js
@@ -122,18 +122,18 @@ function isFlagFilterMatch(item, { type,
       let protocol = item.httpVersion;
       match = typeof protocol === "string" ?
                 protocol.toLowerCase().includes(value) : false;
       break;
     case "domain":
       match = item.urlDetails.host.toLowerCase().includes(value);
       break;
     case "remote-ip":
-      match = getFormattedIPAndPort(item.remoteAddress, item.remotePort)
-        .toLowerCase().includes(value);
+      let data = getFormattedIPAndPort(item.remoteAddress, item.remotePort);
+      match = data ? data.toLowerCase().includes(value) : false;
       break;
     case "has-response-header":
       if (typeof item.responseHeaders === "object") {
         let { headers } = item.responseHeaders;
         match = headers.findIndex(h => h.name.toLowerCase() === value) > -1;
       } else {
         match = false;
       }