Archid
Warlord
Found what looks to be a couple of minor bugs:
The first issue is in placeIndex. If an entry has no text the code to collate all the entries throws an index out of bounds error. I added the following check to get round it
The second issue is because the mod I am helping with has no Projects. This throws an index out of bounds error in the sortProjects() method, which was easy enough to resolve with the following:
This then required another change in the placeIndex method as it doesn't handle empty arrays when processing all the different objects types. I changed this:
to this:
to fix it.
The first issue is in placeIndex. If an entry has no text the code to collate all the entries throws an index out of bounds error. I added the following check to get round it
Code:
lIndex = {}
for item in listSorted:
[COLOR="DarkRed"]if not unicode(item[0]): continue[/COLOR]
sKey = unicode(item[0])[0]
if not sKey in lIndex:
lIndex[sKey] = []
lIndex[sKey].append(item)
lIndex = lIndex.items()
lIndex.sort()
The second issue is because the mod I am helping with has no Projects. This throws an index out of bounds error in the sortProjects() method, which was easy enough to resolve with the following:
Code:
def sortProjects(self, iType):
lSorted = []
[COLOR="DarkRed"] if gc.getNumProjectInfos() == 0: return lSorted[/COLOR]
lItems = []
.....
This then required another change in the placeIndex method as it doesn't handle empty arrays when processing all the different objects types. I changed this:
Code:
for item in self.sortProjects(0)[0][2]:
listSorted.append([item[0], gc.getProjectInfo(item[1]).getButton(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROJECT, item[1], 1])
Code:
sublist = self.sortProjects(0)
if len(sublist):
for item in sublist[0][2]:
listSorted.append([item[0], gc.getProjectInfo(item[1]).getButton(), "", WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROJECT, item[1], 1])
to fix it.