summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterchatterbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterchatterbox.cpp')
-rw-r--r--indra/newview/llfloaterchatterbox.cpp43
1 files changed, 28 insertions, 15 deletions
diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp
index a283b445f5..3389770b2f 100644
--- a/indra/newview/llfloaterchatterbox.cpp
+++ b/indra/newview/llfloaterchatterbox.cpp
@@ -98,8 +98,7 @@ void* LLFloaterMyFriends::createGroupsPanel(void* data)
//static
LLFloaterMyFriends* LLFloaterMyFriends::getInstance()
{
- LLFloater* inst = LLFloaterReg::getInstance("contacts", "friends") ;
- return dynamic_cast<LLFloaterMyFriends*>(inst);
+ return LLFloaterReg::getTypedInstance<LLFloaterMyFriends>("contacts", "friends") ;
}
//
@@ -123,11 +122,14 @@ BOOL LLFloaterChatterBox::postBuild()
if (gSavedSettings.getBOOL("ContactsTornOff"))
{
LLFloaterMyFriends* floater_contacts = LLFloaterMyFriends::getInstance();
- // add then remove to set up relationship for re-attach
- addFloater(floater_contacts, FALSE);
- removeFloater(floater_contacts);
- // reparent to floater view
- gFloaterView->addChild(floater_contacts);
+ if(floater_contacts)
+ {
+ // add then remove to set up relationship for re-attach
+ addFloater(floater_contacts, FALSE);
+ removeFloater(floater_contacts);
+ // reparent to floater view
+ gFloaterView->addChild(floater_contacts);
+ }
}
else
{
@@ -137,11 +139,14 @@ BOOL LLFloaterChatterBox::postBuild()
if (gSavedSettings.getBOOL("ChatHistoryTornOff"))
{
LLFloaterChat* floater_chat = LLFloaterChat::getInstance();
- // add then remove to set up relationship for re-attach
- addFloater(floater_chat, FALSE);
- removeFloater(floater_chat);
- // reparent to floater view
- gFloaterView->addChild(floater_chat);
+ if(floater_chat)
+ {
+ // add then remove to set up relationship for re-attach
+ addFloater(floater_chat, FALSE);
+ removeFloater(floater_chat);
+ // reparent to floater view
+ gFloaterView->addChild(floater_chat);
+ }
}
else
{
@@ -249,11 +254,17 @@ void LLFloaterChatterBox::setMinimized(BOOL minimized)
{
LLFloater::setMinimized(minimized);
// HACK: potentially need to toggle console
- LLFloaterChat::getInstance()->updateConsoleVisibility();
+ LLFloaterChat* instance = LLFloaterChat::getInstance();
+ if(instance)
+ {
+ instance->updateConsoleVisibility();
+ }
}
void LLFloaterChatterBox::removeFloater(LLFloater* floaterp)
{
+ if(!floaterp) return;
+
if (floaterp->getName() == "chat floater")
{
// only my friends floater now locked
@@ -275,6 +286,8 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp,
BOOL select_added_floater,
LLTabContainer::eInsertionPoint insertion_point)
{
+ if(!floaterp) return;
+
S32 num_locked_tabs = mTabContainer->getNumLockedTabs();
// already here
@@ -332,8 +345,7 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp,
//static
LLFloaterChatterBox* LLFloaterChatterBox::getInstance()
{
- LLFloater* inst = LLFloaterReg::getInstance("communicate", LLSD()) ;
- return dynamic_cast<LLFloaterChatterBox*>(inst);
+ return LLFloaterReg::getTypedInstance<LLFloaterChatterBox>("communicate", LLSD()) ;
}
//static
@@ -351,6 +363,7 @@ LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater()
else
{
LLFloaterChatterBox* floater = LLFloaterChatterBox::getInstance();
+ if(!floater) return NULL;
// iterator over all IM tabs (skip friends and near me)
for (S32 i = 0; i < floater->getFloaterCount(); i++)
{