Bug 1132229: Return in Dispatch method if Bluetooth runnable is nullptr, r=shuang

With this patch, the dispatch method of Bluetooth runnables simply returns
if the supplied runnable is nullptr. This makes is easy to handle cases
where the caller of a Bluetooth interface method is not interested in the
result.
This commit is contained in:
Thomas Zimmermann 2015-02-26 09:52:45 +01:00
parent cfe2b0b4b0
commit 33620bd78f

View File

@ -49,6 +49,9 @@ public:
static void
Dispatch(Obj* aObj, Res (Obj::*aMethod)(), const InitOp& aInitOp)
{
if (!aObj) {
return; // silently return if no result runnable has been given
}
nsRefPtr<SelfType> runnable = Create(aObj, aMethod, aInitOp);
if (!runnable) {
BT_LOGR("BluetoothResultRunnable0::Create failed");
@ -108,6 +111,9 @@ public:
static void
Dispatch(Obj* aObj, Res (Obj::*aMethod)(Arg1), const InitOp& aInitOp)
{
if (!aObj) {
return; // silently return if no result runnable has been given
}
nsRefPtr<SelfType> runnable = Create(aObj, aMethod, aInitOp);
if (!runnable) {
BT_LOGR("BluetoothResultRunnable1::Create failed");
@ -174,6 +180,9 @@ public:
Dispatch(Obj* aObj, Res (Obj::*aMethod)(Arg1, Arg2, Arg3),
const InitOp& aInitOp)
{
if (!aObj) {
return; // silently return if no result runnable has been given
}
nsRefPtr<SelfType> runnable = Create(aObj, aMethod, aInitOp);
if (!runnable) {
BT_LOGR("BluetoothResultRunnable3::Create failed");