From cffaf55a9c09b6a4a0eb73a681142ecdc802f2e0 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 3 Jan 2015 22:12:54 +0000 Subject: [PATCH] loot_get_masterlist_revision() error code fix. Don't use an error code when the masterlist simply isn't under version control or doesn't exist, they are expected circumstances for the function to be called under. --- src/api/api.cpp | 5 ++++- src/backend/git.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/api/api.cpp b/src/api/api.cpp index bb9b0800..427c0ff6 100644 --- a/src/api/api.cpp +++ b/src/api/api.cpp @@ -527,7 +527,10 @@ LOOT_API unsigned int loot_get_masterlist_revision(loot_db db, db->extRevisionDate = ToNewCString(date); } catch (loot::error &e) { - return c_error(e); + if (e.code() == loot_ok) + return loot_ok; + else + return c_error(e); } catch (std::bad_alloc& e) { return c_error(loot_error_no_mem, e.what()); diff --git a/src/backend/git.cpp b/src/backend/git.cpp index 655c1bc8..20d010e4 100644 --- a/src/backend/git.cpp +++ b/src/backend/git.cpp @@ -214,10 +214,10 @@ namespace loot { void Masterlist::GetGitInfo(const boost::filesystem::path& path, bool shortID) { if (!isRepository(path.parent_path())) { - throw error(error::git_error, "Unknown: Git repository missing"); + throw error(error::ok, "Unknown: Git repository missing"); } else if (!fs::exists(path)) { - throw error(error::git_error, "N/A: No masterlist present"); + throw error(error::ok, "N/A: No masterlist present"); } // Compare HEAD and working copy, and get revision info.