fix crash when activating menu that is not in range

Summary: add the condition check code if the pressed key is not in range of menu items

Test Plan:
(1) Left-click on the desktop to bring up the menu.
(2) Press down the number key to activate the menu item.
(3) When you press down the number key that is not in range, you will see the segmentation error.

below is the crash log which I encoutered.
-------------------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
_e_menu_item_activate_nth (n=n@entry=5) at src/bin/e_menu.c:2318
2318       _e_menu_item_ensure_onscreen(mi);

Reviewers: zmike, gwanglim, raster

Reviewed By: raster

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1845
This commit is contained in:
Duna Oh 2015-01-09 14:51:40 +09:00 committed by Carsten Haitzler (Rasterman)
parent 5d74b399e0
commit 576ec9bdc4
1 changed files with 1 additions and 0 deletions

View File

@ -2211,6 +2211,7 @@ _e_menu_item_activate_nth(int n)
if (!mi->separator) i++;
if (i == n) break;
}
if (!mi) return;
e_menu_item_active_set(mi, 1);
_e_menu_item_ensure_onscreen(mi);
}