Fix #115023: Error Measuring Null Menu Item Name

Do not attempt to measure the length of a null string.

Pull Request: https://projects.blender.org/blender/blender/pulls/115027
This commit is contained in:
Harley Acheson
2023-11-17 06:00:28 +01:00
committed by Harley Acheson
parent f815484e7d
commit be97ed2828

View File

@@ -4353,8 +4353,10 @@ static void ui_def_but_rna__menu(bContext *C, uiLayout *layout, void *but_p)
if (item->icon) {
has_item_with_icon = true;
}
float item_width = BLF_width(BLF_default(), item->name, BLF_DRAW_STR_DUMMY_MAX);
col_width = MAX2(col_width, item_width + (120.0f * UI_SCALE_FAC));
if (item->name && item->name[0]) {
float item_width = BLF_width(BLF_default(), item->name, BLF_DRAW_STR_DUMMY_MAX);
col_width = MAX2(col_width, item_width + (120.0f * UI_SCALE_FAC));
}
rows = MAX2(rows, col_rows);
}
text_width += col_width;