void GetCursorPosition( GetCursorPositionParameters& parameters,
CursorInfo& cursorInfo )
{
+ const LineRun* const modelLines = parameters.visualModel->mLines.Begin();
+ if( NULL == modelLines )
+ {
+ // Nothing to do.
+ return;
+ }
+
// Whether the logical cursor position is at the end of the whole text.
const bool isLastPosition = parameters.logicalModel->mText.Count() == parameters.logical;
// Whether the cursor is in the last position and the last position is a new paragraph character.
const bool isLastNewParagraph = parameters.isMultiline && isLastPosition && TextAbstraction::IsNewParagraph( *( parameters.logicalModel->mText.Begin() + characterOfLine ) );
- const LineRun* const modelLines = parameters.visualModel->mLines.Begin();
-
const LineIndex lineIndex = parameters.visualModel->GetLineOfCharacter( characterOfLine );
const LineRun& line = *( modelLines + lineIndex );
// Set the primary cursor's height.
cursorInfo.primaryCursorHeight = cursorInfo.isSecondaryCursor ? 0.5f * glyphMetrics.fontHeight : glyphMetrics.fontHeight;
-
cursorInfo.glyphOffset = line.ascender - glyphMetrics.ascender;
// Set the primary cursor's position.
cursorInfo.primaryPosition.x = -glyphMetrics.xBearing + primaryPosition.x + glyphAdvance;