Fix crash in wxGraphicsPen::CreatePen() after wxPenInfo changes
Don't unconditionally dereference the result of wxPen::GetStipple()
which can (and often is) null.
This fixes crash introduced in 40f8403f5d
.
This commit is contained in:
@@ -828,17 +828,22 @@ wxGraphicsPen wxGraphicsContext::CreatePen(const wxPen& pen) const
|
|||||||
if ( !pen.IsOk() )
|
if ( !pen.IsOk() )
|
||||||
return wxGraphicsPen();
|
return wxGraphicsPen();
|
||||||
|
|
||||||
wxDash *dashes;
|
wxGraphicsPenInfo info = wxGraphicsPenInfo()
|
||||||
int nb_dashes = pen.GetDashes(&dashes);
|
.Colour(pen.GetColour())
|
||||||
|
.Width(pen.GetWidth())
|
||||||
|
.Style(pen.GetStyle())
|
||||||
|
.Join(pen.GetJoin())
|
||||||
|
.Cap(pen.GetCap())
|
||||||
|
;
|
||||||
|
|
||||||
return DoCreatePen(wxGraphicsPenInfo()
|
wxDash *dashes;
|
||||||
.Colour(pen.GetColour())
|
if ( int nb_dashes = pen.GetDashes(&dashes) )
|
||||||
.Width(pen.GetWidth())
|
info.Dashes(nb_dashes, dashes);
|
||||||
.Style(pen.GetStyle())
|
|
||||||
.Stipple(*pen.GetStipple())
|
if ( wxBitmap* const stipple = pen.GetStipple() )
|
||||||
.Dashes(nb_dashes, dashes)
|
info.Stipple(*stipple);
|
||||||
.Join(pen.GetJoin())
|
|
||||||
.Cap(pen.GetCap()));
|
return DoCreatePen(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGraphicsPen wxGraphicsContext::DoCreatePen(const wxGraphicsPenInfo& info) const
|
wxGraphicsPen wxGraphicsContext::DoCreatePen(const wxGraphicsPenInfo& info) const
|
||||||
|
Reference in New Issue
Block a user