[Bf-blender-cvs] [18302f3dfa5] gpencil-new-data-proposal: Fix: `strokes_as_curves()` can return null curves
Hans Goudey
noreply at git.blender.org
Mon Dec 12 20:35:48 CET 2022
Commit: 18302f3dfa5fb5e3299c8609cbf4425467048322
Author: Hans Goudey
Date: Mon Dec 12 13:08:01 2022 -0600
Branches: gpencil-new-data-proposal
https://developer.blender.org/rB18302f3dfa5fb5e3299c8609cbf4425467048322
Fix: `strokes_as_curves()` can return null curves
===================================================================
M source/blender/blenkernel/intern/gpencil_new_proposal.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc b/source/blender/blenkernel/intern/gpencil_new_proposal.cc
index 551e0bd58fe..5f91d050f6b 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc
@@ -164,11 +164,15 @@ bool GPFrame::operator==(const GPFrame &other) const
CurvesGeometry &GPFrame::strokes_as_curves()
{
+ if (!this->strokes) {
+ this->strokes = MEM_new<CurvesGeometry>(__func__);
+ }
return CurvesGeometry::wrap(*this->strokes);
}
const CurvesGeometry &GPFrame::strokes_as_curves() const
{
+ BLI_assert(this->strokes != nullptr);
return CurvesGeometry::wrap(*this->strokes);
}
@@ -206,9 +210,6 @@ Vector<GPStroke> GPFrame::strokes_for_write()
GPStroke GPFrame::add_new_stroke(int new_points_num)
{
- if (this->strokes == nullptr) {
- this->strokes = MEM_new<CurvesGeometry>(__func__);
- }
CurvesGeometry &strokes = this->strokes_as_curves();
int orig_last_offset = strokes.offsets().last();
@@ -667,4 +668,4 @@ void GPData::update_frames_array()
this->runtime->frames_index_range_cache.clear();
}
-} // namespace blender::bke
\ No newline at end of file
+} // namespace blender::bke
More information about the Bf-blender-cvs
mailing list