From c843f8e7f963670bcf939ff689bcaab6119ea92c Mon Sep 17 00:00:00 2001 From: blagoev Date: Sat, 9 Sep 2017 02:00:46 +0300 Subject: [PATCH] Validate callback was registered on unregistration --- src/js_sync.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/js_sync.hpp b/src/js_sync.hpp index 168ba535..80fc1fcb 100644 --- a/src/js_sync.hpp +++ b/src/js_sync.hpp @@ -375,6 +375,10 @@ void SessionClass::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");