Fix for Text::Controller::RepositionSelectionHandles() 51/118051/1
authorVictor Cebollada <v.cebollada@samsung.com>
Wed, 8 Mar 2017 11:24:19 +0000 (11:24 +0000)
committerVictor Cebollada <v.cebollada@samsung.com>
Wed, 8 Mar 2017 11:24:19 +0000 (11:24 +0000)
* Fixes an invalid memory read reported by valgrind.

Change-Id: I8625fdbd3203130b73327964d9b5ae063677938f
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
dali-toolkit/internal/text/text-controller-impl.cpp

index 2c1b772ff9a92eb30f6158de40d763509c2dba67..c54ca22fc7ae8096a0104fd61eb900add68b7159 100644 (file)
@@ -1964,15 +1964,15 @@ void Controller::Impl::RepositionSelectionHandles()
     // Whether to retrieve the next line.
     if( index == lastGlyphOfLine )
     {
-      // Retrieve the next line.
-      ++lineRun;
-
-      // Get the last glyph of the new line.
-      lastGlyphOfLine = lineRun->glyphRun.glyphIndex + lineRun->glyphRun.numberOfGlyphs - 1u;
-
       ++lineIndex;
       if( lineIndex < firstLineIndex + numberOfLines )
       {
+        // Retrieve the next line.
+        ++lineRun;
+
+        // Get the last glyph of the new line.
+        lastGlyphOfLine = lineRun->glyphRun.glyphIndex + lineRun->glyphRun.numberOfGlyphs - 1u;
+
         // Keep the offset and height of the current selection box.
         const float currentLineOffset = selectionBoxInfo->lineOffset;
         const float currentLineHeight = selectionBoxInfo->lineHeight;