1
0
Fork 0
mirror of synced 2024-06-19 02:54:45 +12:00

RareEosOverlay: Protect against invalid prefixes

This commit is contained in:
loathingKernel 2023-09-13 21:23:01 +03:00
parent 889a7cd116
commit acbe8836cc

View file

@ -583,16 +583,29 @@ class RareEosOverlay(RareGameBase):
self.core.check_for_overlay_updates() self.core.check_for_overlay_updates()
return self.core.overlay_update_available return self.core.overlay_update_available
def is_enabled(self, prefix: Optional[str] = None): def is_enabled(self, prefix: Optional[str] = None) -> bool:
reg_paths = eos.query_registry_entries(prefix) try:
reg_paths = eos.query_registry_entries(prefix)
except ValueError as e:
logger.info("%s %s", e, prefix)
return False
return reg_paths["overlay_path"] and self.core.is_overlay_install(reg_paths["overlay_path"]) return reg_paths["overlay_path"] and self.core.is_overlay_install(reg_paths["overlay_path"])
def active_path(self, prefix: Optional[str] = None) -> str: def active_path(self, prefix: Optional[str] = None) -> str:
path = eos.query_registry_entries(prefix)["overlay_path"] try:
path = eos.query_registry_entries(prefix)["overlay_path"]
except ValueError as e:
logger.info("%s %s", e, prefix)
return ""
return path if path and self.core.is_overlay_install(path) else "" return path if path and self.core.is_overlay_install(path) else ""
def available_paths(self, prefix: Optional[str] = None) -> List[str]: def available_paths(self, prefix: Optional[str] = None) -> List[str]:
return self.core.search_overlay_installs(prefix) try:
installs = self.core.search_overlay_installs(prefix)
except ValueError as e:
logger.info("%s %s", e, prefix)
return []
return installs
def enable( def enable(
self, prefix: Optional[str] = None, path: Optional[str] = None self, prefix: Optional[str] = None, path: Optional[str] = None