Fix #148010: instant crash opening any file with Dopesheet and Keyframes

Fix the code path that left the `color` pointer uninitialized when
drawing.

Pull Request: https://projects.blender.org/blender/blender/pulls/148013
This commit is contained in:
Sybren A. Stüvel
2025-10-14 09:17:03 +02:00
parent cac573c507
commit 3a75bae825

View File

@@ -306,7 +306,7 @@ static void draw_keylist_block_interpolation_line(const DrawKeylistUIData *ctx,
box.ymax = ypos + ctx->ipo_size;
/* Color for interpolation lines based on their type */
const float *color;
const float *color = nullptr;
constexpr short IPO_FLAGS = ACTKEYBLOCK_FLAG_IPO_OTHER | ACTKEYBLOCK_FLAG_IPO_LINEAR |
ACTKEYBLOCK_FLAG_IPO_CONSTANT;
@@ -314,16 +314,18 @@ static void draw_keylist_block_interpolation_line(const DrawKeylistUIData *ctx,
/* This is a summary line that combines multiple interpolation modes. */
color = ctx->ipo_color_mix;
}
else if (ab->block.flag & ACTKEYBLOCK_FLAG_IPO_OTHER) {
color = ctx->ipo_color_other;
}
else if (ab->block.flag & ACTKEYBLOCK_FLAG_IPO_LINEAR) {
color = ctx->ipo_color_linear;
}
else if (ab->block.flag & ACTKEYBLOCK_FLAG_IPO_CONSTANT) {
color = ctx->ipo_color_constant;
}
else {
if (ab->block.flag & ACTKEYBLOCK_FLAG_IPO_OTHER) {
color = ctx->ipo_color_other;
}
else if (ab->block.flag & ACTKEYBLOCK_FLAG_IPO_LINEAR) {
color = ctx->ipo_color_linear;
}
else if (ab->block.flag & ACTKEYBLOCK_FLAG_IPO_CONSTANT) {
color = ctx->ipo_color_constant;
}
/* No line to draw. */
return;
}
UI_draw_roundbox_4fv(&box, true, 3.0f, color);