Make clicking button outside of form not crash (bug 163327), r=alexsavulov@netscape.com, sr=dbaron@fas.harvard.edu

This commit is contained in:
jkeiser%netscape.com 2002-08-22 02:49:36 +00:00
parent 60da39d7ff
commit 60ffc18bd5

View File

@ -501,7 +501,8 @@ nsHTMLButtonElement::HandleDOMEvent(nsIPresContext* aPresContext,
case NS_MOUSE_LEFT_CLICK:
{
if (mType == NS_FORM_BUTTON_SUBMIT || mType == NS_FORM_BUTTON_RESET) {
if ((mType == NS_FORM_BUTTON_SUBMIT || mType == NS_FORM_BUTTON_RESET) &&
mForm) {
nsFormEvent event;
event.eventStructType = NS_FORM_EVENT;
event.message = (mType == NS_FORM_BUTTON_RESET)