[Python-checkins] python/dist/src/Mac/Tools/IDE PyBrowser.py,1.15,1.16
jvr@users.sourceforge.net
jvr@users.sourceforge.net
Mon, 16 Sep 2002 14:18:51 -0700
Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE
In directory usw-pr-cvs1:/tmp/cvs-serv10215
Modified Files:
PyBrowser.py
Log Message:
make sure the object browser can't crash because when the list data gets bigger than 32kB
Index: PyBrowser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyBrowser.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** PyBrowser.py 26 Mar 2002 12:06:11 -0000 1.15
--- PyBrowser.py 16 Sep 2002 21:18:49 -0000 1.16
***************
*** 388,399 ****
data = theList.LGetCell(dataLen, theCell)
iconId, indent, tab = struct.unpack("hhh", data[:6])
! key, value = data[6:].split("\t", 1)
if iconId:
! theIcon = Icn.GetCIcon(iconId)
! rect = (0, 0, 16, 16)
! rect = Qd.OffsetRect(rect, l, t)
! rect = Qd.OffsetRect(rect, 0, (theList.cellSize[1] - (rect[3] - rect[1])) / 2)
! Icn.PlotCIcon(rect, theIcon)
if len(key) >= 0:
--- 388,411 ----
data = theList.LGetCell(dataLen, theCell)
iconId, indent, tab = struct.unpack("hhh", data[:6])
! try:
! key, value = data[6:].split("\t", 1)
! except ValueError:
! # bogus data, at least don't crash.
! indent = 0
! tab = 0
! iconId = 0
! key = ""
! value = data[6:]
if iconId:
! try:
! theIcon = Icn.GetCIcon(iconId)
! except Icn.Error:
! pass
! else:
! rect = (0, 0, 16, 16)
! rect = Qd.OffsetRect(rect, l, t)
! rect = Qd.OffsetRect(rect, 0, (theList.cellSize[1] - (rect[3] - rect[1])) / 2)
! Icn.PlotCIcon(rect, theIcon)
if len(key) >= 0:
***************
*** 412,415 ****
--- 424,429 ----
#elif dataLen != 0:
# drawTextCell("???", 3, cellRect, ascent, theList)
+ else:
+ return # we have bogus data
# draw nice dotted line