mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Avoid crash with incompatible save on startup
This commit is contained in:
parent
c4bc515e19
commit
cbaf509375
@ -108,7 +108,7 @@ class QLiberationWindow(QMainWindow):
|
|||||||
if last_save_file:
|
if last_save_file:
|
||||||
logging.info("Loading last saved game : " + str(last_save_file))
|
logging.info("Loading last saved game : " + str(last_save_file))
|
||||||
game = persistency.load_game(last_save_file)
|
game = persistency.load_game(last_save_file)
|
||||||
self.migrate_game(game, last_save_file)
|
game = self.migrate_game(game, last_save_file)
|
||||||
self.onGameGenerated(game)
|
self.onGameGenerated(game)
|
||||||
self.updateWindowTitle(last_save_file if game else None)
|
self.updateWindowTitle(last_save_file if game else None)
|
||||||
else:
|
else:
|
||||||
@ -316,7 +316,7 @@ class QLiberationWindow(QMainWindow):
|
|||||||
)
|
)
|
||||||
if file is not None and file[0] != "":
|
if file is not None and file[0] != "":
|
||||||
game = persistency.load_game(file[0])
|
game = persistency.load_game(file[0])
|
||||||
self.migrate_game(game, file[0])
|
game = self.migrate_game(game, file[0])
|
||||||
GameUpdateSignal.get_instance().game_loaded.emit(game)
|
GameUpdateSignal.get_instance().game_loaded.emit(game)
|
||||||
|
|
||||||
self.updateWindowTitle(file[0])
|
self.updateWindowTitle(file[0])
|
||||||
@ -324,8 +324,16 @@ class QLiberationWindow(QMainWindow):
|
|||||||
def migrate_game(self, game, path):
|
def migrate_game(self, game, path):
|
||||||
if game:
|
if game:
|
||||||
is_liberation = ".liberation" in path
|
is_liberation = ".liberation" in path
|
||||||
|
try:
|
||||||
Migrator(game, is_liberation)
|
Migrator(game, is_liberation)
|
||||||
|
return game
|
||||||
|
except Exception:
|
||||||
|
self.incompatible_save_popup(path)
|
||||||
else:
|
else:
|
||||||
|
self.incompatible_save_popup(path)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def incompatible_save_popup(self, path):
|
||||||
relative_path = Path(path)
|
relative_path = Path(path)
|
||||||
QMessageBox.critical(
|
QMessageBox.critical(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user