text: Fix checking NULL after dereferencing 64/272964/2
authorShinwoo Kim <cinoo.kim@samsung.com>
Tue, 29 Mar 2022 00:13:57 +0000 (09:13 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Tue, 29 Mar 2022 00:17:17 +0000 (09:17 +0900)
This was detected by static analysis tool.

Change-Id: I4a4566b5537e905c61cc16e38e54fe7d15fdae17

dali-toolkit/internal/text/text-view.cpp

index 1ec978d..697dc04 100644 (file)
@@ -114,11 +114,12 @@ Length View::GetGlyphs(GlyphInfo* glyphs,
   float                   calculatedAdvance           = 0.f;
   const Character*        textBuffer                  = mImpl->mLogicalModel->mText.Begin();
 
   float                   calculatedAdvance           = 0.f;
   const Character*        textBuffer                  = mImpl->mLogicalModel->mText.Begin();
 
-  // Get the character-spacing runs.
-  const Vector<CharacterSpacingGlyphRun>& characterSpacingGlyphRuns = mImpl->mVisualModel->GetCharacterSpacingGlyphRuns();
 
   if(mImpl->mVisualModel)
   {
 
   if(mImpl->mVisualModel)
   {
+    // Get the character-spacing runs.
+    const Vector<CharacterSpacingGlyphRun>& characterSpacingGlyphRuns = mImpl->mVisualModel->GetCharacterSpacingGlyphRuns();
+
     bool                              textElided       = false;
     DevelText::EllipsisPosition::Type ellipsisPosition = GetEllipsisPosition();
 
     bool                              textElided       = false;
     DevelText::EllipsisPosition::Type ellipsisPosition = GetEllipsisPosition();