Fixed crash when starts on OS X with wxPython 3.0.x
authoralexander@macbook-pro-alexander.local
Sat, 10 Sep 2016 11:19:40 +0500
changeset 1528 d551f2925a86
parent 1527 642bae8e8607
child 1529 0a131f6a4c86
Fixed crash when starts on OS X with wxPython 3.0.x
controls/LibraryPanel.py
--- a/controls/LibraryPanel.py	Fri Sep 09 11:47:00 2016 +0500
+++ b/controls/LibraryPanel.py	Sat Sep 10 11:19:40 2016 +0500
@@ -67,8 +67,12 @@
                   self.OnSearchButtonClick, self.SearchCtrl)
         # Bind keyboard event on SearchCtrl text control to catch UP and DOWN
         # for search previous and next occurrence
-        search_textctrl = self.SearchCtrl.GetChildren()[0]
-        search_textctrl.Bind(wx.EVT_CHAR, self.OnKeyDown)
+
+        # This protects from fail to start when no children[0] available (possible for wxPython 3.0)
+        if self.SearchCtrl.GetChildren():
+            search_textctrl = self.SearchCtrl.GetChildren()[0]
+            search_textctrl.Bind(wx.EVT_CHAR, self.OnKeyDown)
+
         main_sizer.AddWindow(self.SearchCtrl, flag=wx.GROW)
         
         # Add Splitter window for tree and block comment to main sizer