i7guokui commented on PR #115:
URL:
https://github.com/apache/skywalking-client-js/pull/115#issuecomment-1765619667
> > When the match variable is null, the url will be '', and reading
match[1] will result in a runtime error.
>
> I did not reproduce this issue, and the `match && match[1]` is in codes, I
don't think the error will happen.
// background-image: url('https://www.example.com/test.png')
const match = getStyle(item.ele,
'background-image').match(/url\(\"(.*?)\"\)/);
let url: string = '';
if (match && match[1]) { // match would be null and this branch would not be
executed
url = match[1];
}
if (!url.includes('http')) { // url would be '' and this branch would be
executed
url = location.protocol + match[1]; // throw a error when read property 1
from match, because match would be null
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]