Index: src/FilterEngine.cpp |
diff --git a/src/FilterEngine.cpp b/src/FilterEngine.cpp |
index 333e13930aa14fce4bc53a26d06488597a0497d9..8c2698d33acfc14a34facdfe4b041190c1e53655 100644 |
--- a/src/FilterEngine.cpp |
+++ b/src/FilterEngine.cpp |
@@ -499,17 +499,17 @@ void FilterEngine::UpdateAvailable( |
} |
void FilterEngine::ForceUpdateCheck( |
- FilterEngine::UpdateCheckDoneCallback callback) |
+ const FilterEngine::UpdateCheckDoneCallback& callback) |
{ |
- std::string eventName = "_updateCheckDone"; |
- eventName += ++updateCheckId; |
- |
- jsEngine->SetEventCallback(eventName, std::bind(&FilterEngine::UpdateCheckDone, |
- this, eventName, callback, std::placeholders::_1)); |
- |
JsValuePtr func = jsEngine->Evaluate("API.forceUpdateCheck"); |
JsValueList params; |
- params.push_back(jsEngine->NewValue(eventName)); |
+ if (callback) |
+ { |
+ std::string eventName = "_updateCheckDone" + std::to_string(++updateCheckId); |
+ jsEngine->SetEventCallback(eventName, std::bind(&FilterEngine::UpdateCheckDone, |
+ this, eventName, callback, std::placeholders::_1)); |
+ params.push_back(jsEngine->NewValue(eventName)); |
+ } |
func->Call(params); |
} |