From 7626267ec565f9a2cf761582257e17e3e25d8710 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Thu, 23 Feb 2023 11:57:15 -0800 Subject: [PATCH] fix(trace): do not access null content window (#21166) --- packages/trace-viewer/src/ui/snapshotTab.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/trace-viewer/src/ui/snapshotTab.tsx b/packages/trace-viewer/src/ui/snapshotTab.tsx index 5606fc37c5..fba0c01a65 100644 --- a/packages/trace-viewer/src/ui/snapshotTab.tsx +++ b/packages/trace-viewer/src/ui/snapshotTab.tsx @@ -208,10 +208,8 @@ export const InspectModeController: React.FunctionComponent<{ setHighlightedLocator: (locator: string) => void, }> = ({ iframe, isInspecting, sdkLanguage, testIdAttributeName, highlightedLocator, setHighlightedLocator }) => { React.useEffect(() => { - if (!iframe) - return; - const win = iframe.contentWindow as any; - if (!isInspecting && !highlightedLocator && !win._recorder) + const win = iframe?.contentWindow as any; + if (!win || !isInspecting && !highlightedLocator && !win._recorder) return; let recorder: Recorder | undefined = win._recorder; if (!recorder) {