mirror of
https://github.com/aclist/dztui.git
synced 2026-08-27 10:17:31 +02:00
fix: prevent stuck launch dialog when history file is missing
update_history_file() opened dzg.history in read mode without handling a missing file. dzg.history is only created the first time it is written, so on a fresh install the very first server connection raised FileNotFoundError inside the post-launch cleanup callback: _destroy_on_idle -> _add_to_history_and_return -> update_history_file The exception propagated out of the GLib idle callback before destroy_dialog() ran, orphaning the "Waiting for DayZ to launch" modal so it could never be closed from the UI and its Cancel button was unresponsive. Treat a missing history file as an empty history so the first connection records history normally instead of crashing the cleanup callback.
This commit is contained in:
parent
90c7d9f73e
commit
494311e8df
@ -55,8 +55,11 @@ class ConfigManager:
|
||||
self.update_config(Preferences.IP_LIST, ips)
|
||||
|
||||
def update_history_file(self, fqip: str) -> None:
|
||||
with open(self.prefs.paths.history, "r") as f:
|
||||
ips = [line.rstrip() for line in f.readlines()]
|
||||
try:
|
||||
with open(self.prefs.paths.history, "r") as f:
|
||||
ips = [line.rstrip() for line in f.readlines()]
|
||||
except FileNotFoundError:
|
||||
ips = []
|
||||
|
||||
seen = set()
|
||||
ips.append(fqip)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user