Repository: kivy/kivy

Issue:
Showcase crash on android (sometimes)
Here is the backtrace i just got:

```
I/python  (18144): [INFO              ] [Base        ] Leaving application in progress...
I/python  (18144):  Traceback (most recent call last):
I/python  (18144):    File "/home/tito/code/kivy/examples/demo/showcase/main.py", line 212, in <module>
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/app.py", line 792, in run
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/base.py", line 481, in runTouchApp
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/core/window/window_pygame.py", line 381, in mainloop
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/core/window/window_pygame.py", line 287, in _mainloop
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/base.py", line 324, in idle
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/base.py", line 309, in dispatch_input
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/base.py", line 220, in post_dispatch_input
I/python  (18144):    File "_event.pyx", line 316, in kivy._event.EventDispatcher.dispatch (kivy/_event.c:4537)
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/core/window/__init__.py", line 645, in on_motion
I/python  (18144):    File "_event.pyx", line 316, in kivy._event.EventDispatcher.dispatch (kivy/_event.c:4537)
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/core/window/__init__.py", line 657, in on_touch_down
I/python  (18144):    File "_event.pyx", line 316, in kivy._event.EventDispatcher.dispatch (kivy/_event.c:4537)
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/uix/dropdown.py", line 272, in on_touch_down
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/uix/dropdown.py", line 227, in dismiss
I/python  (18144):    File "_event.pyx", line 312, in kivy._event.EventDispatcher.dispatch (kivy/_event.c:4491)
I/python  (18144):    File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/uix/actionbar.py", line 293, in _toggle_dropdown
I/python  (18144):  IndexError: list index out of range
```

I think it has something to do when i was trying to click on the top of the dropdown. Maybe i was out of the bounds?



Discussion:

Resolving patch:
diff --git a/kivy/uix/actionbar.py b/kivy/uix/actionbar.py
--- a/kivy/uix/actionbar.py
+++ b/kivy/uix/actionbar.py
@@ -289,8 +289,12 @@ def _toggle_dropdown(self, *largs):
         if not ddn.container:
             return
         children = ddn.container.children
-        ddn.width = max([self.width,
-                        children[0].minimum_width])
+
+        if children:
+            ddn.width = max([self.width, children[0].minimum_width])
+        else:
+            ddn.width = self.width
+
         for item in children:
             item.size_hint_y = None
             item.height = max([self.height, sp(48)])


Test patch: