Add enabled property to menu items and check for length of menu items to prevent crashing when an out of bounds index is passed to getItem