Fix T104261: crash when trying to draw viewer overlay for empty curve

`BKE_displist_make_curveTypes` only sets `curve_eval` if the final geometry
of the object actually contains curve data, otherwise it's null.
This commit is contained in:
Jacques Lucke 2023-02-02 17:20:57 +01:00
parent fdc81be213
commit ca99a59605
Notes: blender-bot 2023-02-13 23:17:13 +01:00
Referenced by issue #104261, Geometry Node: Crash if Preview node trying to show instaces of Collection with curve with Beveling
1 changed files with 7 additions and 5 deletions

View File

@ -131,11 +131,13 @@ static void populate_cache_for_geometry(Object &object,
}
case OB_CURVES_LEGACY: {
Curve *curve = static_cast<Curve *>(object.data);
const bke::CurvesGeometry &curves = curve->curve_eval->geometry.wrap();
if (curves.attributes().contains(".viewer")) {
GPUBatch *batch = DRW_cache_curve_edge_wire_viewer_attribute_get(&object);
DRW_shgroup_uniform_float_copy(pd.viewer_attribute_curve_grp, "opacity", opacity);
DRW_shgroup_call_obmat(pd.viewer_attribute_curve_grp, batch, object.object_to_world);
if (curve->curve_eval) {
const bke::CurvesGeometry &curves = curve->curve_eval->geometry.wrap();
if (curves.attributes().contains(".viewer")) {
GPUBatch *batch = DRW_cache_curve_edge_wire_viewer_attribute_get(&object);
DRW_shgroup_uniform_float_copy(pd.viewer_attribute_curve_grp, "opacity", opacity);
DRW_shgroup_call_obmat(pd.viewer_attribute_curve_grp, batch, object.object_to_world);
}
}
break;
}