From bd792754f1685a2c1b4d6d3b7dca34498c047e6c Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 17 Aug 2010 08:05:12 +0000 Subject: [PATCH] CID 1396: NULL pointer dereference. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38174 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../import_export/styled_text/StyledTextImporter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp b/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp index 1b8e6285e8..37ac3a65ae 100644 --- a/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp +++ b/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp @@ -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; }