Fix #136252: Extra chevron on Particle context data breadcrumbs

Dont increment the path count (and dont create a corresponding pointer)
in `ButsContextPath` when there is no current particle system.
This alone would do the trick for particles, but I have also changed
`buttons_panel_context_draw` slightly (so that it checks if the pointer
is valid -- earlying out otherwise -- **before** drawing the triangle
icon) in case it might happen elsewhere too.

Pull Request: https://projects.blender.org/blender/blender/pulls/136256
This commit is contained in:
Philipp Oeser
2025-03-21 10:35:31 +01:00
committed by Philipp Oeser
parent f3c513f342
commit 109100869a

View File

@@ -437,9 +437,10 @@ static bool buttons_context_path_particle(ButsContextPath *path)
if (ob && ob->type == OB_MESH) {
ParticleSystem *psys = psys_get_current(ob);
path->ptr[path->len] = RNA_pointer_create_discrete(&ob->id, &RNA_ParticleSystem, psys);
path->len++;
if (psys != nullptr) {
path->ptr[path->len] = RNA_pointer_create_discrete(&ob->id, &RNA_ParticleSystem, psys);
path->len++;
}
return true;
}
}
@@ -1226,15 +1227,15 @@ static void buttons_panel_context_draw(const bContext *C, Panel *panel)
continue;
}
if (ptr->data == nullptr) {
continue;
}
/* Add > triangle. */
if (!first) {
uiItemL(row, "", ICON_RIGHTARROW);
}
if (ptr->data == nullptr) {
continue;
}
/* Add icon and name. */
int icon = RNA_struct_ui_icon(ptr->type);
char namebuf[128];