summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-07-12 23:28:13 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-07-12 23:28:13 +0300
commit0c3149eb7dbcf484f13f511e7d9f137636ad1ea8 (patch)
treee62221ea13a6d7860fd8e712abb28bcc9169b932
parent618766da89bc5a4be17e4ddb10d8b06c269aee23 (diff)
SL-17759 Crash at LLProgressBar::draw
mImageBar and mImageFill are specified as optional
-rw-r--r--indra/llui/llprogressbar.cpp24
1 files 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)