From c6c5a93bf457bd9a4bd33fe846a9e5235b93198b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 24 Jul 2021 18:10:38 +0200 Subject: [PATCH] Couple of minor things, crashfix on deserialization failure --- Common/File/Path.cpp | 2 +- Common/File/Path.h | 2 +- Common/Serialize/Serializer.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Common/File/Path.cpp b/Common/File/Path.cpp index a45112599e..96110fc2d3 100644 --- a/Common/File/Path.cpp +++ b/Common/File/Path.cpp @@ -301,7 +301,7 @@ bool Path::IsAbsolute() const { return false; } -std::string Path::PathTo(const Path &other) { +std::string Path::PathTo(const Path &other) const { if (!other.StartsWith(*this)) { // Can't do this. Should return an error. return std::string(); diff --git a/Common/File/Path.h b/Common/File/Path.h index 3b0c911203..afec18ac7e 100644 --- a/Common/File/Path.h +++ b/Common/File/Path.h @@ -82,7 +82,7 @@ public: // For Android directory trees, navigates to the root of the tree. Path GetRootVolume() const; - std::string PathTo(const Path &child); + std::string PathTo(const Path &child) const; bool operator ==(const Path &other) const { return path_ == other.path_ && type_ == other.type_; diff --git a/Common/Serialize/Serializer.h b/Common/Serialize/Serializer.h index cfe14f01d8..77f024975c 100644 --- a/Common/Serialize/Serializer.h +++ b/Common/Serialize/Serializer.h @@ -143,7 +143,8 @@ public: if (p.error != p.ERROR_FAILURE) { return ERROR_NONE; } else { - *errorString = std::string("Failure at ") + p.GetBadSectionTitle(); + std::string badSectionTitle = p.GetBadSectionTitle() ? p.GetBadSectionTitle() : "(unknown bad section)"; + *errorString = std::string("Failure at ") + badSectionTitle; return ERROR_BROKEN_STATE; } }