Fix #141808: Crash when a FileHandler uses an operator with no filepath

Add a null check and error in the UI.

Ref !141850
This commit is contained in:
Campbell Barton
2025-07-13 19:55:21 +10:00
parent eec0392f92
commit d006fea2da
@@ -3014,10 +3014,22 @@ static void draw_export_properties(bContext *C,
uiLayoutSetPropDecorate(col, false);
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "filepath");
std::string placeholder = "//" + filename;
uiItemFullR(
col, op->ptr, prop, RNA_NO_INDEX, 0, UI_ITEM_NONE, nullptr, ICON_NONE, placeholder.c_str());
if (prop) {
std::string placeholder = "//" + filename;
uiItemFullR(col,
op->ptr,
prop,
RNA_NO_INDEX,
0,
UI_ITEM_NONE,
nullptr,
ICON_NONE,
placeholder.c_str());
}
else {
std::string label = std::string(IFACE_("<filepath> not found in: ")) + op->idname;
uiItemL(col, label.c_str(), ICON_ERROR);
}
template_operator_property_buts_draw_single(
C, op, layout, UI_BUT_LABEL_ALIGN_NONE, UI_TEMPLATE_OP_PROPS_HIDE_PRESETS);
}