mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 07:05:39 +00:00
Fixed crash when RatingComponent's size was 0.
This commit is contained in:
parent
7ca0b0fe72
commit
2203e9ff81
|
@ -44,11 +44,14 @@ void RatingComponent::onSizeChanged()
|
||||||
auto filledSVG = dynamic_cast<SVGResource*>(mFilledTexture.get());
|
auto filledSVG = dynamic_cast<SVGResource*>(mFilledTexture.get());
|
||||||
auto unfilledSVG = dynamic_cast<SVGResource*>(mUnfilledTexture.get());
|
auto unfilledSVG = dynamic_cast<SVGResource*>(mUnfilledTexture.get());
|
||||||
|
|
||||||
|
if(mSize.y() > 0)
|
||||||
|
{
|
||||||
size_t sz = (size_t)round(mSize.y());
|
size_t sz = (size_t)round(mSize.y());
|
||||||
if(filledSVG)
|
if(filledSVG)
|
||||||
filledSVG->rasterizeAt(sz, sz);
|
filledSVG->rasterizeAt(sz, sz);
|
||||||
if(unfilledSVG)
|
if(unfilledSVG)
|
||||||
unfilledSVG->rasterizeAt(sz, sz);
|
unfilledSVG->rasterizeAt(sz, sz);
|
||||||
|
}
|
||||||
|
|
||||||
updateVertices();
|
updateVertices();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ void SVGResource::initFromMemory(const char* file, size_t length)
|
||||||
|
|
||||||
void SVGResource::rasterizeAt(size_t width, size_t height)
|
void SVGResource::rasterizeAt(size_t width, size_t height)
|
||||||
{
|
{
|
||||||
if(!mSVGImage)
|
if(!mSVGImage || width == 0 || height == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(width != (int)round(mSVGImage->width) && height != (int)round(mSVGImage->height))
|
if(width != (int)round(mSVGImage->width) && height != (int)round(mSVGImage->height))
|
||||||
|
|
Loading…
Reference in a new issue