mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 07:02:50 +01: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:
1 parent
90c7d9f73e
commit
494311e8df
1 file changed
+5
-2
@@ -55,8 +55,11 @@ class ConfigManager:
|
|||||||
self.update_config(Preferences.IP_LIST, ips)
|
self.update_config(Preferences.IP_LIST, ips)
|
||||||
|
|
||||||
def update_history_file(self, fqip: str) -> None:
|
def update_history_file(self, fqip: str) -> None:
|
||||||
with open(self.prefs.paths.history, "r") as f:
|
try:
|
||||||
ips = [line.rstrip() for line in f.readlines()]
|
with open(self.prefs.paths.history, "r") as f:
|
||||||
|
ips = [line.rstrip() for line in f.readlines()]
|
||||||
|
except FileNotFoundError:
|
||||||
|
ips = []
|
||||||
|
|
||||||
seen = set()
|
seen = set()
|
||||||
ips.append(fqip)
|
ips.append(fqip)
|
||||||
|
|||||||
Reference in new issue
Block a user