Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:handle unloaded namespaces #51

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ovos_gui/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,10 @@ def _load_pages(self, pages_to_show: List[GuiPage], show_index: int):
@param pages_to_show: list of pages to be loaded
@param show_index: index to load pages at
"""
if not self.active_namespaces:
LOG.error("received 'load_pages' request but there are no active namespaces")
return

if not len(pages_to_show) or show_index >= len(pages_to_show):
LOG.error(f"requested invalid page index: {show_index}, defaulting to last page")
show_index = len(pages_to_show) - 1
Expand Down Expand Up @@ -1011,6 +1015,10 @@ def handle_namespace_global_back(self, message: Optional[Message]):
Handles global back events from the GUI.
@param message: the event sent by the GUI
"""
if not self.active_namespaces:
LOG.error("received 'back' signal but there are no active namespaces")
return

JarbasAl marked this conversation as resolved.
Show resolved Hide resolved
namespace_name = self.active_namespaces[0].skill_id
namespace = self.loaded_namespaces.get(namespace_name)
if namespace in self.active_namespaces:
Expand Down
Loading