Fix T74838: fix dereferencing of NULL in sculpt_no_multires_poll when no active object exists
Fix crash when the operator search is used while no active object exists. The cause of the issue is an attempt to dereference `ob` when it is `NULL`. Therefore this patch checks the return value of `SCULPT_mode_poll()` first, to ensure that `ob` isn't `NULL`. Reviewed By: pablodp606 Maniphest Tasks: T74838 Differential Revision: https://developer.blender.org/D7156
This commit is contained in:
parent
24e44143a1
commit
d374237d43
Notes:
blender-bot
2023-05-31 04:43:10 +02:00
Referenced by issue #74838, Crash when typing certain keys in search bar
|
@ -8371,9 +8371,8 @@ static void SCULPT_OT_optimize(wmOperatorType *ot)
|
|||
static bool sculpt_no_multires_poll(bContext *C)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
if (ss && ss->pbvh && SCULPT_mode_poll(C)) {
|
||||
return BKE_pbvh_type(ss->pbvh) != PBVH_GRIDS;
|
||||
if (SCULPT_mode_poll(C) && ob->sculpt && ob->sculpt->pbvh) {
|
||||
return BKE_pbvh_type(ob->sculpt->pbvh) != PBVH_GRIDS;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue