summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/url_fixer_upper.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 23:38:16 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 23:38:16 +0000
commit43101c0334b3297868085e661a2e92f935434a5e (patch)
treef681fad14c27259bf344fb1392ca5dd5b39bdce9 /chrome/browser/net/url_fixer_upper.cc
parenteb6439387ab5035450035d606f6ff32319c13789 (diff)
downloadchromium_src-43101c0334b3297868085e661a2e92f935434a5e.zip
chromium_src-43101c0334b3297868085e661a2e92f935434a5e.tar.gz
chromium_src-43101c0334b3297868085e661a2e92f935434a5e.tar.bz2
Properly handle empty components when converting url_parse::Parsed object.
Add a unittest for the below bug. BUG=9859 Review URL: http://codereview.chromium.org/62162 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13388 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/url_fixer_upper.cc')
-rw-r--r--chrome/browser/net/url_fixer_upper.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc
index 39ae80c..9fb17c4 100644
--- a/chrome/browser/net/url_fixer_upper.cc
+++ b/chrome/browser/net/url_fixer_upper.cc
@@ -31,6 +31,9 @@ namespace {
url_parse::Component UTF8ComponentToWideComponent(
string text_utf8,
const url_parse::Component& component_utf8) {
+ if (component_utf8.len == -1)
+ return url_parse::Component();
+
string before_component_string = text_utf8.substr(0, component_utf8.begin);
string component_string = text_utf8.substr(component_utf8.begin,
component_utf8.len);