Fix crash accessing null extra cel when rendering interactive text (fix #5227)
build / build (Debug, macos-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, macos-latest, noscripts, cli) (push) Has been cancelled Details
build / build (Debug, ubuntu-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, ubuntu-latest, noscripts, cli) (push) Has been cancelled Details
build / build (Debug, windows-latest, lua, cli) (push) Has been cancelled Details
build / build (Debug, windows-latest, noscripts, cli) (push) Has been cancelled Details
build / build (RelWithDebInfo, macos-latest, lua, gui) (push) Has been cancelled Details
build / build (RelWithDebInfo, ubuntu-latest, lua, gui) (push) Has been cancelled Details
build / build (RelWithDebInfo, windows-latest, lua, gui) (push) Has been cancelled Details

This commit is contained in:
David Capello 2025-06-20 09:44:25 -03:00
parent 444ef0f6b4
commit ab29b84f25
1 changed files with 19 additions and 4 deletions

View File

@ -85,7 +85,8 @@ public:
void setExtraCelBounds(const gfx::Rect& bounds)
{
if (bounds.w != m_extraCel->image()->width() || bounds.h != m_extraCel->image()->height()) {
doc::Image* extraImg = m_extraCel->image();
if (!extraImg || bounds.w != extraImg->width() || bounds.h != extraImg->height()) {
createExtraCel(m_editor->getSite(), bounds);
}
else {
@ -228,12 +229,21 @@ private:
void renderExtraCelBase()
{
auto extraImg = m_extraCel->image();
doc::Image* extraImg = m_extraCel->image();
ASSERT(extraImg);
if (!extraImg)
return;
const doc::Cel* extraCel = m_extraCel->cel();
ASSERT(extraCel);
if (!extraCel)
return;
extraImg->clear(extraImg->maskColor());
render::Render().renderLayer(extraImg,
m_editor->layer(),
m_editor->frame(),
gfx::Clip(0, 0, m_extraCel->cel()->bounds()),
gfx::Clip(0, 0, extraCel->bounds()),
doc::BlendMode::SRC);
}
@ -271,7 +281,12 @@ private:
}
}
doc::blend_image(m_extraCel->image(),
doc::Image* extraImg = m_extraCel->image();
ASSERT(extraImg);
if (!extraImg)
return;
doc::blend_image(extraImg,
image.get(),
gfx::Clip(image->bounds().size()),
m_doc->sprite()->palette(m_editor->frame()),