Skip to content

Commit f6a81fe

Browse files
committed
WebBrowserComponent: On Linux, avoid asserting when no callback is passed to evaluateJavascript()
1 parent d252e8c commit f6a81fe

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

modules/juce_gui_extra/native/juce_WebBrowserComponent_linux.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,10 +1332,9 @@ struct WebBrowserComponent::Impl::Platform : public PlatformInterface,
13321332
g.fillAll (Colours::white);
13331333
}
13341334

1335-
void evaluateJavascript (const String& script, WebBrowserComponent::EvaluationCallback callback) override
1335+
void evaluateJavascript (const String& script, EvaluationCallback callback) override
13361336
{
1337-
if (callback != nullptr)
1338-
evaluationCallbacks.push_back (std::move (callback));
1337+
evaluationCallbacks.push_back (std::move (callback));
13391338

13401339
CommandReceiver::sendCommand (outChannel,
13411340
"evaluateJavascript",
@@ -1346,7 +1345,7 @@ struct WebBrowserComponent::Impl::Platform : public PlatformInterface,
13461345
{
13471346
const auto params = FromVar::convert<EvaluateJavascriptCallbackParams> (paramsIn);
13481347

1349-
if (! params.has_value() || evaluationCallbacks.size() == 0)
1348+
if (! params.has_value() || evaluationCallbacks.empty())
13501349
{
13511350
jassertfalse;
13521351
return;
@@ -1368,7 +1367,7 @@ struct WebBrowserComponent::Impl::Platform : public PlatformInterface,
13681367
});
13691368

13701369
auto& cb = evaluationCallbacks.front();
1371-
cb (result);
1370+
NullCheckedInvocation::invoke (cb, result);
13721371
evaluationCallbacks.pop_front();
13731372
}
13741373

0 commit comments

Comments
 (0)