From 0c3149eb7dbcf484f13f511e7d9f137636ad1ea8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 12 Jul 2022 23:28:13 +0300 Subject: SL-17759 Crash at LLProgressBar::draw mImageBar and mImageFill are specified as optional --- indra/llui/llprogressbar.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/indra/llui/llprogressbar.cpp b/indra/llui/llprogressbar.cpp index 209796565c..cf57b1fe76 100644 --- a/indra/llui/llprogressbar.cpp +++ b/indra/llui/llprogressbar.cpp @@ -69,16 +69,22 @@ void LLProgressBar::draw() static LLTimer timer; F32 alpha = getDrawContext().mAlpha; - LLColor4 image_bar_color = mColorBackground.get(); - image_bar_color.setAlpha(alpha); - mImageBar->draw(getLocalRect(), image_bar_color); + if (mImageBar) // optional according to parameters + { + LLColor4 image_bar_color = mColorBackground.get(); + image_bar_color.setAlpha(alpha); + mImageBar->draw(getLocalRect(), image_bar_color); + } - alpha *= 0.5f + 0.5f*0.5f*(1.f + (F32)sin(3.f*timer.getElapsedTimeF32())); - LLColor4 bar_color = mColorBar.get(); - bar_color.mV[VALPHA] *= alpha; // modulate alpha - LLRect progress_rect = getLocalRect(); - progress_rect.mRight = ll_round(getRect().getWidth() * (mPercentDone / 100.f)); - mImageFill->draw(progress_rect, bar_color); + if (mImageFill) + { + alpha *= 0.5f + 0.5f*0.5f*(1.f + (F32)sin(3.f*timer.getElapsedTimeF32())); + LLColor4 bar_color = mColorBar.get(); + bar_color.mV[VALPHA] *= alpha; // modulate alpha + LLRect progress_rect = getLocalRect(); + progress_rect.mRight = ll_round(getRect().getWidth() * (mPercentDone / 100.f)); + mImageFill->draw(progress_rect, bar_color); + } } void LLProgressBar::setValue(const LLSD& value) -- cgit v1.2.3