diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-07-31 02:23:32 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-07-31 02:23:32 +0000 |
commit | e6240500a95559f6df4d6b711d0c01c706e13e58 (patch) | |
tree | f1a785921e7793055b00aa2a70a4e715d1e69373 /indra/llui/llcombobox.cpp | |
parent | b3a83059c464c9a974d547f57ab8e93ca0bee0f1 (diff) |
Minor change to protect against odd case where mArrowImage was NULL (unclear why it's happening, but the extra checks are not a bad thing).
Diffstat (limited to 'indra/llui/llcombobox.cpp')
-rw-r--r-- | indra/llui/llcombobox.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 51f9d6bd18..45423920d6 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -117,6 +117,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) mArrowImage = button_params.image_unselected; mButton = LLUICtrlFactory::create<LLButton>(button_params); + + if(mAllowTextEntry) { //redo to compensate for button hack that leaves space for a character @@ -430,7 +432,8 @@ void LLComboBox::setButtonVisible(BOOL visible) LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0); if (visible) { - text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth()) + 2 * drop_shadow_button; + S32 arrow_width = mArrowImage ? mArrowImage->getWidth() : 0; + text_entry_rect.mRight -= llmax(8,arrow_width) + 2 * drop_shadow_button; } //mTextEntry->setRect(text_entry_rect); mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), TRUE); @@ -472,14 +475,15 @@ void LLComboBox::createLineEditor(const LLComboBox::Params& p) LLRect rect = getLocalRect(); if (mAllowTextEntry) { + S32 arrow_width = mArrowImage ? mArrowImage->getWidth() : 0; S32 shadow_size = drop_shadow_button; - mButton->setRect(LLRect( getRect().getWidth() - llmax(8,mArrowImage->getWidth()) - 2 * shadow_size, + mButton->setRect(LLRect( getRect().getWidth() - llmax(8,arrow_width) - 2 * shadow_size, rect.mTop, rect.mRight, rect.mBottom)); mButton->setTabStop(FALSE); mButton->setHAlign(LLFontGL::HCENTER); LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0); - text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth()) + 2 * drop_shadow_button; + text_entry_rect.mRight -= llmax(8,arrow_width) + 2 * drop_shadow_button; // clear label on button std::string cur_label = mButton->getLabelSelected(); LLLineEditor::Params params = p.combo_editor; |