Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=10159>
"REGRESSION: delegate returning no menu elements crashes webkit"
No automated test, because there's no way to programmatically open a context menu,
no manual test because there's no way to customize the context menu delegate.
* WebView/WebView.m:
(-[WebView _menuForElement:defaultItems:]): Make sure the context menu returned
some menu items before accessing the first one.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15726
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-07-31 Duncan Wilcox <duncan@mclink.it>
+
+ Reviewed by Darin.
+
+ Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=10159>
+ "REGRESSION: delegate returning no menu elements crashes webkit"
+
+ No automated test, because there's no way to programmatically open a context menu,
+ no manual test because there's no way to customize the context menu delegate.
+
+ * WebView/WebView.m:
+ (-[WebView _menuForElement:defaultItems:]): Make sure the context menu returned
+ some menu items before accessing the first one.
+
2006-07-31 Timothy Hatcher <timothy@apple.com>
Reviewed by John.
// items. This shouldn't affect any clients other than Mail since the tags for the three items
// were not public API. We can remove this code when we no longer support previously-built versions
// of Mail on Tiger. See 4498606 for more details.
- if (([[defaultMenuItems objectAtIndex:0] tag] == WebMenuItemTagSearchInSpotlight) && ([[menuItems objectAtIndex:0] isSeparatorItem])) {
+ if ([menuItems count] && ([[defaultMenuItems objectAtIndex:0] tag] == WebMenuItemTagSearchInSpotlight) && ([[menuItems objectAtIndex:0] isSeparatorItem])) {
ASSERT([[menuItems objectAtIndex:1] isSeparatorItem]);
ASSERT([[defaultMenuItems objectAtIndex:1] tag] == WebMenuItemTagSearchWeb);
ASSERT([[defaultMenuItems objectAtIndex:2] isSeparatorItem]);