From 1936b5769eaf7ee66c2ac55080dc45cf25f9a50a Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Sat, 13 Feb 2010 14:11:20 +0000
Subject: [PATCH] CID-204

Checker: REVERSE_INULL
Function: LLXUIXSDWriter::writeXSD(const std::basic_string<char, std::char_traits<char>, std::allocator<char>>&, const std::basic_string<char, std::char_traits<char>, std::allocator<char>>&, const LLInitParam::BaseBlock &)
File: /indra/llxuixml/llxuiparser.cpp
---
 indra/llxuixml/llxuiparser.cpp | 37 +++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp
index 17399865e52..705e7137c23 100644
--- a/indra/llxuixml/llxuiparser.cpp
+++ b/indra/llxuixml/llxuiparser.cpp
@@ -324,33 +324,34 @@ void LLXUIXSDWriter::writeXSD(const std::string& type_name, const std::string& p
 	// add includes for all possible children
 	const std::type_info* type = *LLWidgetTypeRegistry::instance().getValue(type_name);
 	const widget_registry_t* widget_registryp = LLChildRegistryRegistry::instance().getValue(type);
-	
-	// add include declarations for all valid children
-	for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems();
-		it != widget_registryp->currentRegistrar().endItems();
-		++it)
-	{
-		std::string widget_name = it->first;
-		if (widget_name == type_name)
-		{
-			continue;
-		}
-		LLXMLNodePtr nodep = new LLXMLNode("xs:include", false);
-		nodep->createChild("schemaLocation", true)->setStringValue(widget_name + ".xsd");
-
-		// add to front of schema
-		mSchemaNode->addChild(nodep, mSchemaNode);
-	}
+	llassert(widget_registryp);
 
 	// add choices for valid children
 	if (widget_registryp)
 	{
+		// add include declarations for all valid children
+		for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems();
+		     it != widget_registryp->currentRegistrar().endItems();
+		     ++it)
+		{
+			std::string widget_name = it->first;
+			if (widget_name == type_name)
+			{
+				continue;
+			}
+			LLXMLNodePtr nodep = new LLXMLNode("xs:include", false);
+			nodep->createChild("schemaLocation", true)->setStringValue(widget_name + ".xsd");
+			
+			// add to front of schema
+			mSchemaNode->addChild(nodep, mSchemaNode);
+		}
+
 		for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems();
 			it != widget_registryp->currentRegistrar().endItems();
 			++it)
 		{
 			std::string widget_name = it->first;
-            //<xs:element name="widget_name" type="widget_name">
+			//<xs:element name="widget_name" type="widget_name">
 			LLXMLNodePtr widget_node = mElementNode->createChild("xs:element", false);
 			widget_node->createChild("name", true)->setStringValue(widget_name);
 			widget_node->createChild("type", true)->setStringValue(widget_name);
-- 
GitLab