diff options
Diffstat (limited to 'source/Utility/UriParser.cpp')
-rw-r--r-- | source/Utility/UriParser.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/Utility/UriParser.cpp b/source/Utility/UriParser.cpp index bb57211af4687..a6d81e7a2c8b8 100644 --- a/source/Utility/UriParser.cpp +++ b/source/Utility/UriParser.cpp @@ -22,7 +22,7 @@ using namespace lldb_private; bool UriParser::Parse(llvm::StringRef uri, llvm::StringRef &scheme, llvm::StringRef &hostname, int &port, llvm::StringRef &path) { - llvm::StringRef tmp_scheme, tmp_hostname, tmp_port, tmp_path; + llvm::StringRef tmp_scheme, tmp_hostname, tmp_path; const llvm::StringRef kSchemeSep("://"); auto pos = uri.find(kSchemeSep); @@ -43,7 +43,7 @@ bool UriParser::Parse(llvm::StringRef uri, llvm::StringRef &scheme, ((path_pos != std::string::npos) ? path_pos : uri.size()) - host_pos); // Extract hostname - if (host_port[0] == '[') { + if (!host_port.empty() && host_port[0] == '[') { // hostname is enclosed with square brackets. pos = host_port.find(']'); if (pos == std::string::npos) |