DrawSpline with empty list causes python crash

I'm using wxPython 2.4.2.4, and this line:

pts = []
for pos in border:
  pts.append(wx.Point(pos[0], pos[1]))
dc.DrawSpline(pts)

If there are no points in border, this causes python to segfault.

I can trap it with a simple "if len(pts) > 0:"
But I don't think I should ever be able to segfault python.

John
=:->

John Meinel wrote:

I'm using wxPython 2.4.2.4, and this line:

pts =
for pos in border:
    pts.append(wx.Point(pos[0], pos[1]))
dc.DrawSpline(pts)

If there are no points in border, this causes python to segfault.

I can trap it with a simple "if len(pts) > 0:"
But I don't think I should ever be able to segfault python.

Python isn't, wxWidgets is. :wink: (It's an easy fix though. Thanks for reporting it.)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!