Fix crash related to structure rigs not having meta level, and a traceback that might happen occasionally.

This commit is contained in:
blitzmann
2016-07-05 23:23:55 -04:00
parent c3983a26c5
commit 4d158d99fd
2 changed files with 6 additions and 2 deletions

View File

@@ -41,6 +41,7 @@ class MetaSwap(ContextMenu):
self.moduleLookup = {}
def get_metalevel(x):
if "metaLevel" not in x.attributes: return 0
return x.attributes["metaLevel"].value
def get_metagroup(x):

View File

@@ -231,8 +231,11 @@ class PFNotebook(wx.Panel):
idx = self.GetPageIndex(page)
if toggle and page == self.activePage:
# Set page to the first non-disabled page
self.SetSelection(next(i for i, _ in enumerate(self.pages) if not self.tabsContainer.tabs[i].disabled))
try:
# Set page to the first non-disabled page
self.SetSelection(next(i for i, _ in enumerate(self.pages) if not self.tabsContainer.tabs[i].disabled))
except StopIteration, ex:
self.SetSelection(0)
self.tabsContainer.DisableTab(idx, toggle)