Dali-toolkit: Text controls crash fix
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-run-container.h
index ecac39d..5af8c55 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_TEXT_RUN_CONTAINER_H__
-#define __DALI_TOOLKIT_TEXT_RUN_CONTAINER_H__
+#ifndef DALI_TOOLKIT_TEXT_RUN_CONTAINER_H
+#define DALI_TOOLKIT_TEXT_RUN_CONTAINER_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -178,6 +178,9 @@ void UpdateCharacterRuns( CharacterIndex index,
     {
       T& run = *it;
 
+      if (run.characterRun.numberOfCharacters == 0)
+       continue;
+
       const CharacterIndex lastRunIndex = run.characterRun.characterIndex + run.characterRun.numberOfCharacters - 1u;
 
       if( lastRunIndex < index )
@@ -240,6 +243,9 @@ void UpdateCharacterRuns( CharacterIndex index,
     {
       T& run = *it;
 
+      if (run.characterRun.numberOfCharacters == 0)
+       continue;
+
       // Update the number of characters of the style run.
 
       if( ( 0u == index ) && ( 0u == run.characterRun.characterIndex ) )
@@ -353,4 +359,4 @@ void ClearGlyphRuns( GlyphIndex startIndex,
 
 } // namespace Dali
 
-#endif // __DALI_TOOLKIT_TEXT_RUN_CONTAINER_H__
+#endif // DALI_TOOLKIT_TEXT_RUN_CONTAINER_H