From adc17549c5f0485a30a87e7674c7779ef3155d6c Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sat, 12 May 2012 13:16:29 +0200 Subject: syntx of null pointer dereference checks (bzr r11358) --- src/xml/repr-io.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/xml/repr-io.cpp') 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( sp_xml_ns_uri_prefix(reinterpret_cast(ns->href), - reinterpret_cast(ns->prefix)) ); - void* p0 = reinterpret_cast(const_cast(prefix)); - void* p1 = reinterpret_cast(const_cast(ns->href)); - g_hash_table_insert( prefix_map, p0, p1 ); - } else { + if (ns){ + if (ns->href ) { + prefix = reinterpret_cast( sp_xml_ns_uri_prefix(reinterpret_cast(ns->href), + reinterpret_cast(ns->prefix)) ); + void* p0 = reinterpret_cast(const_cast(prefix)); + void* p1 = reinterpret_cast(const_cast(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; } -- cgit v1.2.3