Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/JsEngine.cpp

Issue 29390668: Noissue - Don't allow to have an empty event callback in JsEngine (Closed)
Patch Set: Created March 21, 2017, 2:27 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/JsEngine.cpp
diff --git a/src/JsEngine.cpp b/src/JsEngine.cpp
index f874cf97c7486193aa51c1ee55a6b8c45ebf1adf..30069a576655905029e0dbd6fddc2515b0dd0c70 100644
--- a/src/JsEngine.cpp
+++ b/src/JsEngine.cpp
@@ -117,6 +117,11 @@ AdblockPlus::JsValuePtr AdblockPlus::JsEngine::Evaluate(const std::string& sourc
void AdblockPlus::JsEngine::SetEventCallback(const std::string& eventName,
AdblockPlus::JsEngine::EventCallback callback)
{
+ if (!callback)
+ {
+ RemoveEventCallback(eventName);
+ return;
+ }
std::lock_guard<std::mutex> lock(eventCallbacksMutex);
eventCallbacks[eventName] = callback;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld