]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/debmetaindex.cc
avoid producing invalid options if repo has no host
[apt.git] / apt-pkg / deb / debmetaindex.cc
index 8d84409a13b767814970d5c069a67c2ebea47e65..cba00aa8eb7510a244e0db2b52795805a35a2cb0 100644 (file)
@@ -1101,8 +1101,11 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type            /*{{{*/
       UseByHash = _config->Find("Acquire::By-Hash", UseByHash);
       {
         std::string const host = ::URI(URI).Host;
-        UseByHash = _config->Find("APT::Acquire::" + host + "::By-Hash", UseByHash);
-        UseByHash = _config->Find("Acquire::" + host + "::By-Hash", UseByHash);
+        if (host.empty() == false)
+        {
+           UseByHash = _config->Find("APT::Acquire::" + host + "::By-Hash", UseByHash);
+           UseByHash = _config->Find("Acquire::" + host + "::By-Hash", UseByHash);
+        }
         std::map<std::string, std::string>::const_iterator const opt = Options.find("by-hash");
         if (opt != Options.end())
            UseByHash = opt->second;