# HG changeset patch
# User alexander@macbook-pro-alexander.local
# Date 1473488380 -18000
# Node ID d551f2925a861976eca5f6b7ebc306432de18d85
# Parent  642bae8e8607cc94d592497a5e4ded58e6c812d8
Fixed crash when starts on OS X with wxPython 3.0.x

diff -r 642bae8e8607 -r d551f2925a86 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