Fix T81674: LibOverride: 'Define Override' UI operation can crash.

Case where RNA is not able to generate a proper path for a property was
not taken into account properly.
This commit is contained in:
Bastien Montagne 2020-10-13 20:34:18 +02:00
parent be3841b1bf
commit 72cfeb2c4e
Notes: blender-bot 2023-02-14 08:08:54 +01:00
Referenced by issue #81674, Library Override: Crash overriding particles system
1 changed files with 7 additions and 0 deletions

View File

@ -558,6 +558,13 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op)
IDOverrideLibraryPropertyOperation *opop = RNA_property_override_property_operation_get(
CTX_data_main(C), &ptr, prop, operation, index, true, NULL, &created);
if (opop == NULL) {
/* Sometimes e.g. RNA cannot generate a path to the given property. */
BKE_reportf(op->reports, RPT_WARNING, "Failed to create the override operation");
return OPERATOR_CANCELLED;
}
if (!created) {
opop->operation = operation;
}