summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webclipboard_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue/webclipboard_impl.cc')
-rw-r--r--webkit/glue/webclipboard_impl.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc
index 3f66c80..2f915d8 100644
--- a/webkit/glue/webclipboard_impl.cc
+++ b/webkit/glue/webclipboard_impl.cc
@@ -131,7 +131,9 @@ WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url) {
uint32 fragment_end = 0;
ClipboardReadHTML(buffer_type, &html_stdstr, &gurl, &fragment_start,
&fragment_end);
- return html_stdstr.substr(fragment_start, fragment_end - fragment_start);
+ if (fragment_start != std::string::npos && fragment_end != std::string::npos)
+ return html_stdstr.substr(fragment_start, fragment_end - fragment_start);
+ return WebString();
}
WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url,