From 7bfce3e4a8214b6660c3e25b8287792b03b8fae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Sun, 18 Dec 2022 15:32:45 +0100 Subject: [PATCH] Fix local browser offering to open broken saves It wouldn't actually open them, it'd just exit back to the currently open save. It's better to tell the user the reason why the save is broken instead. --- src/gui/interface/SaveButton.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/interface/SaveButton.cpp b/src/gui/interface/SaveButton.cpp index 852e3de3f..1b82b8ce2 100644 --- a/src/gui/interface/SaveButton.cpp +++ b/src/gui/interface/SaveButton.cpp @@ -10,6 +10,7 @@ #include "client/SaveFile.h" #include "client/SaveInfo.h" +#include "gui/dialogues/ErrorMessage.h" #include "graphics/Graphics.h" namespace ui { @@ -297,6 +298,11 @@ void SaveButton::OnMouseUnclick(int x, int y, unsigned int button) { return; //left click only! } + if (file && !file->GetGameSave()) + { + new ErrorMessage("Error loading save", file->GetError()); + return; + } if(x>=Size.X-20 && y>=6 && y<=20 && x<=Size.X-6 && selectable) {