Merge pull request #14055 from Dimon4eg/fix-crash-in-LoadingBar

fix crash in LoadingBar
This commit is contained in:
pandamicro 2015-10-08 11:22:43 +08:00
commit e32e8b95a4
1 changed files with 8 additions and 5 deletions

View File

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