Bug fix: internals.textSurroundingNode crashes when the node is NULL

Added NULL check.

BUG=354958
TEST=Check there is no crashes when the minimized test case is passed to
content_shell

Review URL: https://codereview.chromium.org/201573008

git-svn-id: svn://svn.chromium.org/blink/trunk@169849 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9ff527c8
......@@ -2444,6 +2444,8 @@ void Internals::setValueForUser(Element* element, const String& value)
String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long maxLength)
{
if (!node)
return String();
blink::WebPoint point(x, y);
SurroundingText surroundingText(VisiblePosition(node->renderer()->positionForPoint(static_cast<IntPoint>(point))), maxLength);
return surroundingText.content();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment