Patch from alecf to do a null pointer check on argument to GetSelectedIndex().

This commit is contained in:
nisheeth%netscape.com 1999-06-05 00:18:58 +00:00
parent 6da324eafb
commit c670e17ce2
2 changed files with 40 additions and 36 deletions

View File

@ -546,6 +546,8 @@ PRInt32 nsListControlFrame::GetSelectedIndex(nsIFrame *aHitFrame)
PRInt32 index = kNothingSelected;
// Get the content of the frame that was selected
nsIContent* selectedContent = nsnull;
NS_ASSERTION(aHitFrame, "No frame for html <select> element\n");
if (aHitFrame) {
aHitFrame->GetContent(&selectedContent);
// Search the list of option elements looking for a match
@ -568,7 +570,7 @@ PRInt32 nsListControlFrame::GetSelectedIndex(nsIFrame *aHitFrame)
}
NS_RELEASE(options);
}
}
return index;
}

View File

@ -546,6 +546,8 @@ PRInt32 nsListControlFrame::GetSelectedIndex(nsIFrame *aHitFrame)
PRInt32 index = kNothingSelected;
// Get the content of the frame that was selected
nsIContent* selectedContent = nsnull;
NS_ASSERTION(aHitFrame, "No frame for html <select> element\n");
if (aHitFrame) {
aHitFrame->GetContent(&selectedContent);
// Search the list of option elements looking for a match
@ -568,7 +570,7 @@ PRInt32 nsListControlFrame::GetSelectedIndex(nsIFrame *aHitFrame)
}
NS_RELEASE(options);
}
}
return index;
}