Fix: Compositor crash when second image of Mix node is missing

The first input of the compositor Mix node determines resolution,
leading to situation when the second input will always be attempted
to be evaluated. If the first input is a longer image sequence than
the second input it leads to a crash.

Do a null-pointer check and return transparent image in this cases,
similar to what the Movie Clip operation is doing.

Pull Request: https://projects.blender.org/blender/blender/pulls/123493
This commit is contained in:
Sergey Sharybin
2024-06-21 10:22:42 +02:00
committed by Sergey Sharybin
parent 91d5a639dc
commit 320c2e8878

View File

@@ -82,14 +82,24 @@ void ImageOperation::update_memory_buffer_partial(MemoryBuffer *output,
{
const bool ensure_premultiplied = !ELEM(
image_->alpha_mode, IMA_ALPHA_CHANNEL_PACKED, IMA_ALPHA_IGNORE);
output->copy_from(buffer_, area, ensure_premultiplied, true);
if (buffer_) {
output->copy_from(buffer_, area, ensure_premultiplied, true);
}
else {
output->fill(area, COM_COLOR_TRANSPARENT);
}
}
void ImageAlphaOperation::update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> /*inputs*/)
{
output->copy_from(buffer_, area, 3, COM_DATA_TYPE_VALUE_CHANNELS, 0);
if (buffer_) {
output->copy_from(buffer_, area, 3, COM_DATA_TYPE_VALUE_CHANNELS, 0);
}
else {
output->fill(area, COM_VALUE_ZERO);
}
}
} // namespace blender::compositor