File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
packages/rrweb-snapshot/src Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -130,9 +130,17 @@ export function stringifyRule(rule: CSSRule, sheetHref: string | null): string {
130
130
} catch ( error ) {
131
131
importStringified = rule . cssText ;
132
132
}
133
- if ( rule . styleSheet . href ) {
134
- // url()s within the imported stylesheet are relative to _that_ sheet's href
135
- return absolutifyURLs ( importStringified , rule . styleSheet . href ) ;
133
+ // if importStringified is not null,
134
+ // there should be a stylesheet and a rule here,
135
+ // but we avoid errors in this method by checking for null
136
+ // see https://github.com/rrweb-io/rrweb/pull/1686
137
+ try {
138
+ if ( importStringified && rule . styleSheet ?. href ) {
139
+ // url()s within the imported stylesheet are relative to _that_ sheet's href
140
+ return absolutifyURLs ( importStringified , rule . styleSheet . href ) ;
141
+ }
142
+ } catch {
143
+ // swallow this, we'll return null
136
144
}
137
145
return importStringified ;
138
146
} else {
You can’t perform that action at this time.
0 commit comments