if (!pageClient->page()->focusedFrame())
return EINA_FALSE;
- *cursorPos = pageClient->page()->getCursorOffsetPosition();
- String content = pageClient->page()->getContentOfPosition();
- *text = content.length() ? strdup(content.utf8().data()) : strdup("");
+ if (cursorPos)
+ *cursorPos = pageClient->page()->getCursorOffsetPosition();
- LOG(ISF, "Retrieve surrounding text : %s pos : %d\n", *text, *cursorPos);
+ if (text) {
+ String content = pageClient->page()->getContentOfPosition();
+ *text = content.length() ? strdup(content.utf8().data()) : strdup("");
+ }
+
+ LOG(ISF, "Retrieve surrounding text : %s pos : %d\n", text ? *text : "NULL", cursorPos ? *cursorPos : 0);
return EINA_TRUE;
}