From abc18951c6b639bcbacae2dd83a13ef8e02de85d Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Tue, 28 Sep 2010 14:23:32 -0700
Subject: [PATCH] fix for crash when background image not specified for line
 editor

---
 indra/llui/lllineeditor.cpp |  2 ++
 indra/llui/llui.cpp         | 18 ++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index a1fc977ce1b..16e86a8eacf 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -1491,6 +1491,8 @@ void LLLineEditor::drawBackground()
 	{
 		image = mBgImage;
 	}
+
+	if (!image) return;
 	
 	F32 alpha = getDrawContext().mAlpha;
 	// optionally draw programmatic border
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index ff9af21e545..1f86855a1ed 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -1596,23 +1596,25 @@ void LLUI::initClass(const settings_map_t& settings,
 	sWindow = NULL; // set later in startup
 	LLFontGL::sShadowColor = LLUIColorTable::instance().getColor("ColorDropShadow");
 
+	LLUICtrl::CommitCallbackRegistry::Registrar& reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar();
+
 	// Callbacks for associating controls with floater visibilty:
-	LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Floater.Toggle", boost::bind(&LLFloaterReg::toggleFloaterInstance, _2));
-	LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Floater.Show", boost::bind(&LLFloaterReg::showFloaterInstance, _2));
-	LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Floater.Hide", boost::bind(&LLFloaterReg::hideFloaterInstance, _2));
-	LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Floater.InitToVisibilityControl", boost::bind(&LLFloaterReg::initUICtrlToFloaterVisibilityControl, _1, _2));
+	reg.add("Floater.Toggle", boost::bind(&LLFloaterReg::toggleFloaterInstance, _2));
+	reg.add("Floater.Show", boost::bind(&LLFloaterReg::showFloaterInstance, _2));
+	reg.add("Floater.Hide", boost::bind(&LLFloaterReg::hideFloaterInstance, _2));
+	reg.add("Floater.InitToVisibilityControl", boost::bind(&LLFloaterReg::initUICtrlToFloaterVisibilityControl, _1, _2));
 	
 	// Button initialization callback for toggle buttons
-	LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Button.SetFloaterToggle", boost::bind(&LLButton::setFloaterToggle, _1, _2));
+	reg.add("Button.SetFloaterToggle", boost::bind(&LLButton::setFloaterToggle, _1, _2));
 	
 	// Button initialization callback for toggle buttons on dockale floaters
-	LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Button.SetDockableFloaterToggle", boost::bind(&LLButton::setDockableFloaterToggle, _1, _2));
+	reg.add("Button.SetDockableFloaterToggle", boost::bind(&LLButton::setDockableFloaterToggle, _1, _2));
 
 	// Display the help topic for the current context
-	LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Button.ShowHelp", boost::bind(&LLButton::showHelp, _1, _2));
+	reg.add("Button.ShowHelp", boost::bind(&LLButton::showHelp, _1, _2));
 
 	// Currently unused, but kept for reference:
-	LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Button.ToggleFloater", boost::bind(&LLButton::toggleFloaterAndSetToggleState, _1, _2));
+	reg.add("Button.ToggleFloater", boost::bind(&LLButton::toggleFloaterAndSetToggleState, _1, _2));
 	
 	// Used by menus along with Floater.Toggle to display visibility as a checkmark
 	LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.Visible", boost::bind(&LLFloaterReg::floaterInstanceVisible, _2));
-- 
GitLab