Fix crasher in nsRepeatService by adding some sanity checking code.

This commit is contained in:
waterson%netscape.com 2000-01-19 07:40:18 +00:00
parent b4ed4bbdc9
commit 6dab31d4a3

View File

@ -40,7 +40,6 @@ nsRepeatService::nsRepeatService()
nsRepeatService::~nsRepeatService()
{
mCallback = nsnull;
Stop();
}
@ -57,6 +56,10 @@ nsRepeatService::GetInstance()
void nsRepeatService::Start(nsITimerCallback* aCallback)
{
NS_PRECONDITION(aCallback != nsnull, "null ptr");
if (! aCallback)
return;
mCallback = aCallback;
nsresult rv = NS_NewTimer(getter_AddRefs(mRepeatTimer));
@ -85,7 +88,8 @@ void nsRepeatService::Notify(nsITimer *timer)
mRepeatTimer->Init(this, REPEAT_DELAY);
}
mCallback->Notify(timer);
if (mCallback)
mCallback->Notify(timer);
}
NS_IMPL_ISUPPORTS(nsRepeatService, NS_GET_IID(nsITimerCallback));