Add wxCHECK_MSG() to wxGTK RunScript() implementation too
Don't crash if RunScript() is called on a not yet created object. This is also consistent with the macOS version of the code.
This commit is contained in:
@@ -951,6 +951,9 @@ wxString wxWebViewWebKit::GetPageText() const
|
||||
|
||||
bool wxWebViewWebKit::RunScript(const wxString& javascript, wxString* output)
|
||||
{
|
||||
wxCHECK_MSG( m_web_view, false,
|
||||
wxS("wxWebView must be created before calling RunScript()") );
|
||||
|
||||
if ( output != NULL )
|
||||
{
|
||||
wxLogWarning(_("Retrieving JavaScript script output is not supported with WebKit v1"));
|
||||
|
@@ -1172,6 +1172,9 @@ bool wxWebViewWebKit::RunScriptSync(const wxString& javascript, wxString* output
|
||||
|
||||
bool wxWebViewWebKit::RunScript(const wxString& javascript, wxString* output)
|
||||
{
|
||||
wxCHECK_MSG( m_web_view, false,
|
||||
wxS("wxWebView must be created before calling RunScript()") );
|
||||
|
||||
wxJSScriptWrapper wrapJS(javascript, &m_runScriptCount);
|
||||
|
||||
wxString result;
|
||||
|
Reference in New Issue
Block a user