Avoid Svace DEREF_OF_NULL warnings
[platform/core/uifw/dali-adaptor.git] / text / dali / internal / text-abstraction / font-client-plugin-impl.cpp
index 68399fc..970f0ff 100644 (file)
@@ -340,11 +340,15 @@ void FontClient::Plugin::GetDefaultPlatformFontDescription( FontDescription& fon
     FcInitReinitialize(); // FcInitBringUptoDate did not seem to reload config file as was still getting old default font.
 
     FcPattern* matchPattern = FcPatternCreate();
-    FcConfigSubstitute(NULL, matchPattern, FcMatchPattern);
-    FcDefaultSubstitute( matchPattern );
 
-    MatchFontDescriptionToPattern( matchPattern, mDefaultFontDescription );
-    FcPatternDestroy( matchPattern );
+    if( matchPattern )
+    {
+      FcConfigSubstitute( NULL, matchPattern, FcMatchPattern );
+      FcDefaultSubstitute( matchPattern );
+
+      MatchFontDescriptionToPattern( matchPattern, mDefaultFontDescription );
+      FcPatternDestroy( matchPattern );
+    }
 
     mDefaultFontDescriptionCached = true;
   }
@@ -1107,6 +1111,11 @@ FcPattern* FontClient::Plugin::CreateFontFamilyPattern( const FontDescription& f
   // a pattern holds a set of names, each name refers to a property of the font
   FcPattern* fontFamilyPattern = FcPatternCreate();
 
+  if( !fontFamilyPattern )
+  {
+    return NULL;
+  }
+
   // add a property to the pattern for the font family
   FcPatternAddString( fontFamilyPattern, FC_FAMILY, reinterpret_cast<const FcChar8*>( fontDescription.family.c_str() ) );