diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 038bc2a..d228f0e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - v4-dev + - main jobs: release: diff --git a/src/utils/index.ts b/src/utils/index.ts index 4f23c5a..6e28665 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -25,7 +25,7 @@ export function findSP(): Window { if (document.title == 'SP') return window; // new (SP as popup) const navTrees = getGamepadNavigationTrees(); - return navTrees?.find((x: any) => x.m_ID == 'root_1_').Root.Element.ownerDocument.defaultView; + return navTrees?.find((x: any) => x.m_ID == 'root_1_')?.Root?.Element?.ownerDocument?.defaultView; } /** @@ -40,6 +40,6 @@ export function getFocusNavController(): any { */ export function getGamepadNavigationTrees(): any { const focusNav = getFocusNavController(); - const context = focusNav.m_ActiveContext || focusNav.m_LastActiveContext; + const context = focusNav?.m_ActiveContext || focusNav?.m_LastActiveContext; return context?.m_rgGamepadNavigationTrees; }