Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1136)

Unified Diff: Source/core/html/track/WebVTTParser.cpp

Issue 22304002: Crash when calling getCueAsHTML() on a TextTrackCue with empty text (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/track/WebVTTParser.cpp
diff --git a/Source/core/html/track/WebVTTParser.cpp b/Source/core/html/track/WebVTTParser.cpp
index 4a7b524f5922c12f1894f8bc1d2e4719f9ec68e1..4b2dfc22fc6148a2aba985b4302aba35f032b9a3 100644
--- a/Source/core/html/track/WebVTTParser.cpp
+++ b/Source/core/html/track/WebVTTParser.cpp
@@ -328,13 +328,16 @@ PassRefPtr<DocumentFragment> WebVTTParser::createDocumentFragmentFromCueText(co
// 4.8.10.13.4 WebVTT cue text parsing rules and
// 4.8.10.13.5 WebVTT cue text DOM construction rules.
- if (!text.length())
- return 0;
-
ASSERT(m_scriptExecutionContext->isDocument());
Document* document = toDocument(m_scriptExecutionContext);
RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
+
+ if (!text.length()) {
+ fragment->parserAppendChild(Text::create(document, ""));
+ return fragment;
+ }
+
m_currentNode = fragment;
m_tokenizer->reset();
m_token.clear();

Powered by Google App Engine
This is Rietveld 408576698