[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [koffice] filters/karbon/svg: Give runtime warning if default shape
From:       "Dr. Robert Marmorstein" <robert () narnia ! homeunix ! com>
Date:       2011-08-02 9:16:39
Message-ID: 20110802091639.712BAA60AE () git ! kde ! org
[Download RAW message or body]

Git commit 2f9829247a09cc8e471cfcb3b31af6b81ec2a8a3 by Dr. Robert Marmorstein.
Committed on 01/08/2011 at 17:22.
Pushed by robertm into branch 'master'.

Give runtime warning if default shape not created.

I'm not convinced this can actually happen anyway, but
it avoids a NULL pointer dereference in the case that it
does.

M  +6    -1    filters/karbon/svg/SvgParser.cpp

http://commits.kde.org/koffice/2f9829247a09cc8e471cfcb3b31af6b81ec2a8a3

diff --git a/filters/karbon/svg/SvgParser.cpp b/filters/karbon/svg/SvgParser.cpp
index e8ae181..b94c3ef 100644
--- a/filters/karbon/svg/SvgParser.cpp
+++ b/filters/karbon/svg/SvgParser.cpp
@@ -2038,7 +2038,12 @@ KShape * SvgParser::createShape(const QString &shapeID)
     }
 
     KShape *shape = factory->createDefaultShape(m_documentResourceManager);
-    if (shape && shape->shapeId().isEmpty())
+    if (! shape) {
+        kWarning(30514) << "Could not create default shape for SvgParser";
+        return 0;
+    }
+
+    if (shape->shapeId().isEmpty())
         shape->setShapeId(factory->id());
 
     // reset tranformation that might come from the default shape


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic