Couple of minor things, crashfix on deserialization failure

This commit is contained in:
Henrik Rydgård 2021-07-24 18:10:38 +02:00
parent 76e8e89925
commit c6c5a93bf4
3 changed files with 4 additions and 3 deletions

View file

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

View file

@ -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_;

View file

@ -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;
}
}