Skip to content

Commit 10662a5

Browse files
committed
prevent unnecessary error throwing in stringifyRule
1 parent f7db81f commit 10662a5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/pink-queens-shave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"rrweb-snapshot": patch
3+
---
4+
5+
Prevent unnecessary error throwing in stringifyRule that was nullifying csstext of style elements when serializing nodes

packages/rrweb-snapshot/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export function stringifyRule(rule: CSSRule, sheetHref: string | null): string {
170170
} catch (error) {
171171
importStringified = rule.cssText;
172172
}
173-
if (rule.styleSheet.href) {
173+
if (rule?.styleSheet?.href) {
174174
// url()s within the imported stylesheet are relative to _that_ sheet's href
175175
return absolutifyURLs(importStringified, rule.styleSheet.href);
176176
}

0 commit comments

Comments
 (0)