don't call First() on an empty string. b=326874 r=mento

This commit is contained in:
joshmoz%gmail.com 2006-04-28 21:06:59 +00:00
Родитель 1feb2bbb4b
Коммит 0c04fe5fda
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -255,7 +255,7 @@ NS_METHOD nsMenuX::AddMenuItem(nsIMenuItem * aMenuItem)
// I want to be internationalized too! // I want to be internationalized too!
nsAutoString keyEquivalent(NS_LITERAL_STRING(" ")); nsAutoString keyEquivalent(NS_LITERAL_STRING(" "));
aMenuItem->GetShortcutChar(keyEquivalent); aMenuItem->GetShortcutChar(keyEquivalent);
if (!keyEquivalent.EqualsLiteral(" ")) { if (!keyEquivalent.IsEmpty() && !keyEquivalent.EqualsLiteral(" ")) {
ToUpperCase(keyEquivalent); ToUpperCase(keyEquivalent);
short inKey = NS_LossyConvertUTF16toASCII(keyEquivalent).First(); short inKey = NS_LossyConvertUTF16toASCII(keyEquivalent).First();
::SetItemCmd(mMacMenuHandle, currItemIndex, inKey); ::SetItemCmd(mMacMenuHandle, currItemIndex, inKey);