Fixed crash when RatingComponent's size was 0.

This commit is contained in:
Aloshi 2014-03-24 14:45:27 -05:00
parent 7ca0b0fe72
commit 2203e9ff81
2 changed files with 9 additions and 6 deletions

View file

@ -44,11 +44,14 @@ void RatingComponent::onSizeChanged()
auto filledSVG = dynamic_cast<SVGResource*>(mFilledTexture.get());
auto unfilledSVG = dynamic_cast<SVGResource*>(mUnfilledTexture.get());
size_t sz = (size_t)round(mSize.y());
if(filledSVG)
filledSVG->rasterizeAt(sz, sz);
if(unfilledSVG)
unfilledSVG->rasterizeAt(sz, sz);
if(mSize.y() > 0)
{
size_t sz = (size_t)round(mSize.y());
if(filledSVG)
filledSVG->rasterizeAt(sz, sz);
if(unfilledSVG)
unfilledSVG->rasterizeAt(sz, sz);
}
updateVertices();
}

View file

@ -50,7 +50,7 @@ void SVGResource::initFromMemory(const char* file, size_t length)
void SVGResource::rasterizeAt(size_t width, size_t height)
{
if(!mSVGImage)
if(!mSVGImage || width == 0 || height == 0)
return;
if(width != (int)round(mSVGImage->width) && height != (int)round(mSVGImage->height))