[3.0] Fix for Text::Controller::RepositionSelectionHandles() 53/118053/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:29:21 +0000 (11:29 +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 b3e9147..fafd57a 100644 (file)
@@ -2029,15 +2029,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;