Bug 550175 - Check if a row in an autocomplete popup is selected while pressing DEL. r=mak

This commit is contained in:
Andreas Wagner 2012-12-23 11:45:44 -05:00
parent d0c3b92170
commit 1c39a8100b

View File

@ -535,6 +535,12 @@ nsAutoCompleteController::HandleDelete(bool *_retval)
int32_t index, searchIndex, rowIndex;
popup->GetSelectedIndex(&index);
if (index == -1) {
// No row is selected in the list
HandleText();
return NS_OK;
}
RowIndexToSearch(index, &searchIndex, &rowIndex);
NS_ENSURE_TRUE(searchIndex >= 0 && rowIndex >= 0, NS_ERROR_FAILURE);