X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..4f1e1a09ce4daed860e35d359ce2fceccb0764e8:/icuSources/samples/layout/GDIFontMap.cpp diff --git a/icuSources/samples/layout/GDIFontMap.cpp b/icuSources/samples/layout/GDIFontMap.cpp index 30f2f56b..bdbfe30b 100644 --- a/icuSources/samples/layout/GDIFontMap.cpp +++ b/icuSources/samples/layout/GDIFontMap.cpp @@ -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. * @@ -28,5 +32,12 @@ GDIFontMap::~GDIFontMap() 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; }