mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-19 01:20:20 +02:00
fix(Utils): return null when SP not found
This commit is contained in:
@@ -22,7 +22,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,5 +38,5 @@ export function getFocusNavController(): any {
|
||||
export function getGamepadNavigationTrees(): any {
|
||||
const focusNav = getFocusNavController();
|
||||
const context = focusNav.m_ActiveContext || focusNav.m_LastActiveContext;
|
||||
return context.m_rgGamepadNavigationTrees;
|
||||
return context?.m_rgGamepadNavigationTrees;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user