[haiku-commits] r38174 - haiku/trunk/src/apps/icon-o-matic/import_export/styled_text

  • From: pulkomandy@xxxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 17 Aug 2010 10:05:12 +0200 (CEST)

Author: pulkomandy
Date: 2010-08-17 10:05:12 +0200 (Tue, 17 Aug 2010)
New Revision: 38174
Changeset: http://dev.haiku-os.org/changeset/38174

Modified:
   
haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp
Log:
CID 1396: NULL pointer dereference.


Modified: 
haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp
===================================================================
--- 
haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp
  2010-08-17 07:53:58 UTC (rev 38173)
+++ 
haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp
  2010-08-17 08:05:12 UTC (rev 38174)
@@ -320,8 +320,10 @@
                        //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;
                        }


Other related posts: