Fix crash in sculpt poll function without an active object

This commit is contained in:
Campbell Barton
2024-09-06 16:03:03 +10:00
parent 43f7b50df3
commit 016ab453dd

View File

@@ -178,9 +178,11 @@ static void SCULPT_OT_optimize(wmOperatorType *ot)
static bool sculpt_no_multires_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
const bke::pbvh::Tree *pbvh = bke::object::pbvh_get(*ob);
if (SCULPT_mode_poll(C) && ob->sculpt && pbvh) {
return pbvh->type() != bke::pbvh::Type::Grids;
if (ob) {
const bke::pbvh::Tree *pbvh = bke::object::pbvh_get(*ob);
if (SCULPT_mode_poll(C) && ob->sculpt && pbvh) {
return pbvh->type() != bke::pbvh::Type::Grids;
}
}
return false;
}