Skip to content
This repository was archived by the owner on Mar 29, 2021. It is now read-only.

Commit 2689506

Browse files
authored
Merge pull request #81 from pandreyn/master
Added check for result in onGetMatchedStylesForNodeResult
2 parents 87e10b9 + fcbfda0 commit 2689506

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/protocols/ios/ios.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -247,21 +247,23 @@ export abstract class IOSProtocol extends ProtocolAdapter {
247247
private onGetMatchedStylesForNodeResult(msg: any): Promise<any> {
248248
const result = msg.result;
249249

250-
// Convert all the rules into the chrome format
251-
for (let i in result.matchedCSSRules) {
252-
if (result.matchedCSSRules[i].rule) {
253-
this.mapRule(result.matchedCSSRules[i].rule);
254-
}
255-
}
256-
257-
for (let i in result.inherited) {
258-
if (result.inherited[i].matchedCSSRules) {
259-
for (let j in result.inherited[i].matchedCSSRules) {
260-
if (result.inherited[i].matchedCSSRules[j].rule) {
261-
this.mapRule(result.inherited[i].matchedCSSRules[j].rule);
262-
}
263-
}
264-
}
250+
if (result) {
251+
// Convert all the rules into the chrome format
252+
for (let i in result.matchedCSSRules) {
253+
if (result.matchedCSSRules[i].rule) {
254+
this.mapRule(result.matchedCSSRules[i].rule);
255+
}
256+
}
257+
258+
for (let i in result.inherited) {
259+
if (result.inherited[i].matchedCSSRules) {
260+
for (let j in result.inherited[i].matchedCSSRules) {
261+
if (result.inherited[i].matchedCSSRules[j].rule) {
262+
this.mapRule(result.inherited[i].matchedCSSRules[j].rule);
263+
}
264+
}
265+
}
266+
}
265267
}
266268

267269
return Promise.resolve(msg);

0 commit comments

Comments
 (0)