mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Fix crasher in nsRepeatService by adding some sanity checking code.
This commit is contained in:
parent
b4ed4bbdc9
commit
6dab31d4a3
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user