Refactor: ui_draw_popover_back Impossible Null Dereference

The function ui_draw_popover_back has a "block" argument, that is
checked for null, but then has an "else" that would require it and
cause a null pointer dereference. This is an internal function that has
one caller, in response to a condition on that same block's flag.
Therefore this PR removes this function's check for null and the else
code as this condition is not possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/119092
This commit is contained in:
Harley Acheson
2024-03-05 17:39:35 +01:00
committed by Harley Acheson
parent 94770b74be
commit a1f92f5820

View File

@@ -5336,17 +5336,10 @@ void ui_draw_popover_back(ARegion *region, uiStyle * /*style*/, uiBlock *block,
{
uiWidgetType *wt = widget_type(UI_WTYPE_MENU_BACK);
if (block) {
float mval_origin[2] = {float(block->bounds_offset[0]), float(block->bounds_offset[1])};
ui_window_to_block_fl(region, block, &mval_origin[0], &mval_origin[1]);
ui_draw_popover_back_impl(
wt->wcol_theme, rect, block->direction, U.widget_unit / block->aspect, mval_origin);
}
else {
const float zoom = 1.0f / block->aspect;
wt->state(wt, &STATE_INFO_NULL, UI_EMBOSS_UNDEFINED);
wt->draw_block(&wt->wcol, rect, 0, 0, zoom);
}
float mval_origin[2] = {float(block->bounds_offset[0]), float(block->bounds_offset[1])};
ui_window_to_block_fl(region, block, &mval_origin[0], &mval_origin[1]);
ui_draw_popover_back_impl(
wt->wcol_theme, rect, block->direction, U.widget_unit / block->aspect, mval_origin);
ui_draw_clip_tri(block, rect, wt);
}