fix crash in LoadingBar

This commit is contained in:
dimon4eg 2015-09-30 13:04:13 +03:00
parent 4a2edc8ce8
commit ec20b48775
1 changed files with 8 additions and 5 deletions

View File

@ -282,11 +282,14 @@ void LoadingBar::updateProgressBar()
}
else
{
float res = _percent / 100.0f;
Sprite* spriteRenderer = _barRenderer->getSprite();
Rect rect = spriteRenderer->getTextureRect();
rect.size.width = _barRendererTextureSize.width * res;
spriteRenderer->setTextureRect(rect, spriteRenderer->isTextureRectRotated(), rect.size);
Sprite* innerSprite = _barRenderer->getSprite();
if (nullptr != innerSprite)
{
float res = _percent / 100.0f;
Rect rect = innerSprite->getTextureRect();
rect.size.width = _barRendererTextureSize.width * res;
innerSprite->setTextureRect(rect, innerSprite->isTextureRectRotated(), rect.size);
}
}
}