diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-03-29 09:49:09 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-03-29 09:49:09 -0700 |
| commit | 830bd8d44967ba488bd6cb5d18f227e7709b7881 (patch) | |
| tree | ed37595a4684e5332fdf88af7bb5a6c45cb00fb7 /toolsrc/src/vcpkg.cpp | |
| parent | c09a8f990c8a0cd4387550de7ddc96f14491606c (diff) | |
| download | vcpkg-830bd8d44967ba488bd6cb5d18f227e7709b7881.tar.gz vcpkg-830bd8d44967ba488bd6cb5d18f227e7709b7881.zip | |
[vcpkg] Fix regression introduced in 67ce764. Fixes #868. Fixes #866.
Diffstat (limited to 'toolsrc/src/vcpkg.cpp')
| -rw-r--r-- | toolsrc/src/vcpkg.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 069d9a7c1..2b57db484 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -111,23 +111,28 @@ static void loadConfig() try { - auto pghs = Paragraphs::get_paragraphs(localappdata / "vcpkg" / "config").get_or_exit(VCPKG_LINE_INFO); - std::unordered_map<std::string, std::string> keys; - if (pghs.size() > 0) - keys = pghs[0]; - - for (size_t x = 1; x < pghs.size(); ++x) + auto maybe_pghs = Paragraphs::get_paragraphs(localappdata / "vcpkg" / "config"); + if (auto p_pghs = maybe_pghs.get()) { - for (auto&& p : pghs[x]) - keys.insert(p); - } + const auto& pghs = *p_pghs; + + std::unordered_map<std::string, std::string> keys; + if (pghs.size() > 0) + keys = pghs[0]; - auto user_id = keys["User-Id"]; - auto user_time = keys["User-Since"]; - Checks::check_throw(VCPKG_LINE_INFO, !user_id.empty() && !user_time.empty(), ""); // Use as goto to the catch statement + for (size_t x = 1; x < pghs.size(); ++x) + { + for (auto&& p : pghs[x]) + keys.insert(p); + } - SetUserInformation(user_id, user_time); - return; + auto user_id = keys["User-Id"]; + auto user_time = keys["User-Since"]; + Checks::check_throw(VCPKG_LINE_INFO, !user_id.empty() && !user_time.empty(), ""); // Use as goto to the catch statement + + SetUserInformation(user_id, user_time); + return; + } } catch (...) { |
