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

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;
}