From 9326e95cdbe597450f1d3d702deba923380751ee Mon Sep 17 00:00:00 2001 From: Pedro Rodriguez Date: Wed, 4 Sep 2019 09:18:00 +0200 Subject: [PATCH] Call callback even if mediaStream is not present or is closed (#1451) --- erizoAPI/MediaStream.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erizoAPI/MediaStream.cc b/erizoAPI/MediaStream.cc index 81e0a0f70f..ca165c90fc 100644 --- a/erizoAPI/MediaStream.cc +++ b/erizoAPI/MediaStream.cc @@ -392,10 +392,14 @@ NAN_METHOD(MediaStream::enableSlideShowBelowSpatialLayer) { NAN_METHOD(MediaStream::getStats) { MediaStream* obj = Nan::ObjectWrap::Unwrap(info.Holder()); + Nan::Callback *callback = new Nan::Callback(info[0].As()); if (!obj->me || info.Length() != 1 || obj->closed_) { + Local argv[] = { + Nan::New("{}").ToLocalChecked() + }; + Nan::Call(*callback, 1, argv); return; } - Nan::Callback *callback = new Nan::Callback(info[0].As()); AsyncQueueWorker(new StatCallWorker(callback, obj->me)); }