bpy.ops.object.add_named() doesnt provide error when failed (related to T38689)

This commit is contained in:
Dalai Felinto 2014-02-17 19:22:43 -03:00
parent 787623e4a3
commit 3d7e0aae52
Notes: blender-bot 2023-02-14 11:10:54 +01:00
Referenced by issue #38689, bpy.ops.object.add_named() doesnt work with unlinked objects
1 changed files with 5 additions and 1 deletions

View File

@ -2170,8 +2170,11 @@ static int add_named_exec(bContext *C, wmOperator *op)
/* find object, create fake base */
RNA_string_get(op->ptr, "name", name);
ob = (Object *)BKE_libblock_find_name(ID_OB, name);
if (ob == NULL)
if (ob == NULL) {
BKE_report(op->reports, RPT_ERROR, "Object not found");
return OPERATOR_CANCELLED;
}
base = MEM_callocN(sizeof(Base), "duplibase");
base->object = ob;
@ -2185,6 +2188,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
if (basen == NULL) {
MEM_freeN(base);
BKE_report(op->reports, RPT_ERROR, "Object could not be duplicated");
return OPERATOR_CANCELLED;
}