diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2012-05-12 11:16:29 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2012-05-12 11:16:29 +0000 |
| commit | adc17549c5f0485a30a87e7674c7779ef3155d6c (patch) | |
| tree | 5d7600ee04a17673e9af977637c4cd89fe5e4938 /src/xml/repr-io.cpp | |
| parent | Fix for externally reported patch by Juergen Weigert, Bug #993500 (inkscape s... (diff) | |
| download | inkscape-adc17549c5f0485a30a87e7674c7779ef3155d6c.tar.gz inkscape-adc17549c5f0485a30a87e7674c7779ef3155d6c.zip | |
syntx of null pointer dereference checks
(bzr r11358)
Diffstat (limited to 'src/xml/repr-io.cpp')
| -rw-r--r-- | src/xml/repr-io.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index b85e58899..29a5b4a78 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -471,13 +471,19 @@ Document *sp_repr_do_read (xmlDocPtr doc, const gchar *default_ns) gint sp_repr_qualified_name (gchar *p, gint len, xmlNsPtr ns, const xmlChar *name, const gchar */*default_ns*/, GHashTable *prefix_map) { const xmlChar *prefix; - if ( ns && ns->href ) { - prefix = reinterpret_cast<const xmlChar*>( sp_xml_ns_uri_prefix(reinterpret_cast<const gchar*>(ns->href), - reinterpret_cast<const char*>(ns->prefix)) ); - void* p0 = reinterpret_cast<gpointer>(const_cast<xmlChar *>(prefix)); - void* p1 = reinterpret_cast<gpointer>(const_cast<xmlChar *>(ns->href)); - g_hash_table_insert( prefix_map, p0, p1 ); - } else { + if (ns){ + if (ns->href ) { + prefix = reinterpret_cast<const xmlChar*>( sp_xml_ns_uri_prefix(reinterpret_cast<const gchar*>(ns->href), + reinterpret_cast<const char*>(ns->prefix)) ); + void* p0 = reinterpret_cast<gpointer>(const_cast<xmlChar *>(prefix)); + void* p1 = reinterpret_cast<gpointer>(const_cast<xmlChar *>(ns->href)); + g_hash_table_insert( prefix_map, p0, p1 ); + } + else { + prefix = NULL; + } + } + else { prefix = NULL; } @@ -600,10 +606,10 @@ Glib::ustring sp_repr_save_buf(Document *doc) sp_repr_save_writer(doc, &outs, SP_INKSCAPE_NS_URI, 0, 0); - outs.close(); - Glib::ustring buf = souts.getString(); + outs.close(); + Glib::ustring buf = souts.getString(); - return buf; + return buf; } |
