From fed08cf5192a1f37779b4ab002da0b3203d5276d Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Thu, 1 Jul 1999 03:26:43 +0000 Subject: [PATCH] don't crash if parent is null when asking for mouse coordinates. git-svn-id: svn://10.0.0.236/trunk@37637 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/events/src/nsDOMEvent.cpp | 4 ++-- mozilla/layout/events/src/nsDOMEvent.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mozilla/content/events/src/nsDOMEvent.cpp b/mozilla/content/events/src/nsDOMEvent.cpp index b4bc84126f6..71bc563f1a2 100644 --- a/mozilla/content/events/src/nsDOMEvent.cpp +++ b/mozilla/content/events/src/nsDOMEvent.cpp @@ -225,7 +225,7 @@ NS_METHOD nsDOMEvent::GetScreenX(PRInt32* aScreenX) nsIWidget* parent = ((nsGUIEvent*)mEvent)->widget; //Add extra since loop will free one. - NS_ADDREF(parent); + NS_IF_ADDREF(parent); nsIWidget* tmp; while (nsnull != parent) { parent->GetBounds(bounds); @@ -246,7 +246,7 @@ NS_METHOD nsDOMEvent::GetScreenY(PRInt32* aScreenY) nsIWidget* parent = ((nsGUIEvent*)mEvent)->widget; //Add extra since loop will free one. - NS_ADDREF(parent); + NS_IF_ADDREF(parent); nsIWidget* tmp; while (nsnull != parent) { parent->GetBounds(bounds); diff --git a/mozilla/layout/events/src/nsDOMEvent.cpp b/mozilla/layout/events/src/nsDOMEvent.cpp index b4bc84126f6..71bc563f1a2 100644 --- a/mozilla/layout/events/src/nsDOMEvent.cpp +++ b/mozilla/layout/events/src/nsDOMEvent.cpp @@ -225,7 +225,7 @@ NS_METHOD nsDOMEvent::GetScreenX(PRInt32* aScreenX) nsIWidget* parent = ((nsGUIEvent*)mEvent)->widget; //Add extra since loop will free one. - NS_ADDREF(parent); + NS_IF_ADDREF(parent); nsIWidget* tmp; while (nsnull != parent) { parent->GetBounds(bounds); @@ -246,7 +246,7 @@ NS_METHOD nsDOMEvent::GetScreenY(PRInt32* aScreenY) nsIWidget* parent = ((nsGUIEvent*)mEvent)->widget; //Add extra since loop will free one. - NS_ADDREF(parent); + NS_IF_ADDREF(parent); nsIWidget* tmp; while (nsnull != parent) { parent->GetBounds(bounds);