diff options
Diffstat (limited to 'webkit/glue/webframe_impl.cc')
-rw-r--r-- | webkit/glue/webframe_impl.cc | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index 1617c57..03242b6 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -206,20 +206,25 @@ static void FrameContentAsPlainText(int max_chars, Frame* frame, // string conversion. for (TextIterator it(range.get()); !it.atEnd(); it.advance()) { const wchar_t* chars = reinterpret_cast<const wchar_t*>(it.characters()); - if (!chars && it.length() != 0) { - // It appears from crash reports that an iterator can get into a state - // where the character count is nonempty but the character pointer is - // NULL. advance()ing it will then just add that many to the NULL - // pointer which won't be caught in a NULL check but will crash. - // - // A NULL pointer and 0 length is common for some nodes. - // - // IF YOU CATCH THIS IN A DEBUGGER please let brettw know. We don't - // currently understand the conditions for this to occur. Ideally, the - // iterators would never get into the condition so we should fix them - // if we can. - NOTREACHED(); - break; + if (!chars) { + if (it.length() != 0) { + // It appears from crash reports that an iterator can get into a state + // where the character count is nonempty but the character pointer is + // NULL. advance()ing it will then just add that many to the NULL + // pointer which won't be caught in a NULL check but will crash. + // + // A NULL pointer and 0 length is common for some nodes. + // + // IF YOU CATCH THIS IN A DEBUGGER please let brettw know. We don't + // currently understand the conditions for this to occur. Ideally, the + // iterators would never get into the condition so we should fix them + // if we can. + NOTREACHED(); + break; + } + + // Just got a NULL node, we can forge ahead! + continue; } int to_append = std::min(it.length(), max_chars - static_cast<int>(output->size())); |