]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/samples/layout/GDIFontMap.cpp
ICU-62123.0.1.tar.gz
[apple/icu.git] / icuSources / samples / layout / GDIFontMap.cpp
index 30f2f56bcbed88b86fca90bb577ca4226b4d997a..bdbfe30b6dad46ba670ed866d8d4a75e0e30be5f 100644 (file)
@@ -1,4 +1,8 @@
 /*
 /*
+ ******************************************************************************
+ * © 2016 and later: Unicode, Inc. and others.                    *
+ * License & terms of use: http://www.unicode.org/copyright.html#License      *
+ ******************************************************************************
  ******************************************************************************
  * Copyright (C) 1998-2003, International Business Machines Corporation and   *
  * others. All Rights Reserved.                                               *
  ******************************************************************************
  * Copyright (C) 1998-2003, International Business Machines Corporation and   *
  * others. All Rights Reserved.                                               *
@@ -28,5 +32,12 @@ GDIFontMap::~GDIFontMap()
 
 const LEFontInstance *GDIFontMap::openFont(const char *fontName, le_int16 pointSize, LEErrorCode &status)
 {
 
 const LEFontInstance *GDIFontMap::openFont(const char *fontName, le_int16 pointSize, LEErrorCode &status)
 {
-    return new GDIFontInstance(fSurface, fontName, pointSize, status);
+       LEFontInstance *result = new GDIFontInstance(fSurface, fontName, pointSize, status);
+
+       if (LE_FAILURE(status)) {
+               delete result;
+               result = NULL;
+       }
+
+    return result;
 }
 }