Validate callback was registered on unregistration

This commit is contained in:
blagoev 2017-09-09 02:00:46 +03:00
parent 9d02165db1
commit c843f8e7f9
1 changed files with 4 additions and 0 deletions

View File

@ -375,6 +375,10 @@ void SessionClass<T>::remove_progress_notification(ContextType ctx, FunctionType
validate_argument_count(argc, 1);
auto callback_function = Value::validated_to_function(ctx, arguments[0], "callback");
auto syncSessionProp = Object::get_property(ctx, callback_function, "syncSession");
if (Value::is_undefined(ctx, syncSessionProp) || Value::is_null(ctx, syncSessionProp)) {
return;
}
auto syncSession = Value::validated_to_object(ctx, syncSessionProp);
auto registrationToken = Object::get_property(ctx, callback_function, "registrationToken");