Compare commits

...

3 Commits

Author SHA1 Message Date
aclist
a1f851430d
Merge aa43b017d1 into e92df8c062 2026-07-09 03:37:28 +00:00
aclist
e92df8c062
Merge pull request #398 from u-alexandru/fix/history-file-not-found
Some checks failed
Mirror to Codeberg / mirror-to-codeberg (push) Has been cancelled
fix: prevent stuck launch dialog when history file is missing
2026-07-08 10:41:36 +09:00
u-alexandru
494311e8df 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.
2026-07-07 18:45:22 +03:00

View File

@ -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)