CID 1396: NULL pointer dereference.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38174 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2010-08-17 08:05:12 +00:00
parent 6709e6bcb8
commit bd792754f1
@@ -320,8 +320,10 @@ StyledTextImporter::_Import(Icon* icon, const char *text, text_run_array *runs)
//offset.x += glyph.Bounds().Width();
offset.x += charWidth;
Shape* shape = new (nothrow) Shape(NULL);
if (shape == NULL)
return B_NO_MEMORY;
shape->SetName(glyphName.String());
if (!shape || !icon->Shapes()->AddShape(shape)) {
if (!icon->Shapes()->AddShape(shape)) {
delete shape;
return B_NO_MEMORY;
}