1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

WebBrowserComponent: On Linux, avoid asserting when no callback is passed to evaluateJavascript()

This commit is contained in:
reuk 2025-12-17 12:19:32 +00:00
parent d252e8ced5
commit f6a81fe5f2
No known key found for this signature in database

View file

@ -1332,9 +1332,8 @@ public:
g.fillAll (Colours::white); g.fillAll (Colours::white);
} }
void evaluateJavascript (const String& script, WebBrowserComponent::EvaluationCallback callback) override void evaluateJavascript (const String& script, EvaluationCallback callback) override
{ {
if (callback != nullptr)
evaluationCallbacks.push_back (std::move (callback)); evaluationCallbacks.push_back (std::move (callback));
CommandReceiver::sendCommand (outChannel, CommandReceiver::sendCommand (outChannel,
@ -1346,7 +1345,7 @@ public:
{ {
const auto params = FromVar::convert<EvaluateJavascriptCallbackParams> (paramsIn); const auto params = FromVar::convert<EvaluateJavascriptCallbackParams> (paramsIn);
if (! params.has_value() || evaluationCallbacks.size() == 0) if (! params.has_value() || evaluationCallbacks.empty())
{ {
jassertfalse; jassertfalse;
return; return;
@ -1368,7 +1367,7 @@ public:
}); });
auto& cb = evaluationCallbacks.front(); auto& cb = evaluationCallbacks.front();
cb (result); NullCheckedInvocation::invoke (cb, result);
evaluationCallbacks.pop_front(); evaluationCallbacks.pop_front();
} }