Skip to content

Commit 7a30bbb

Browse files
committed
Added error message when passing a local browser to executeBrowserJavascript
1 parent 71a78fa commit 7a30bbb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

MTA10/mods/shared_logic/lua/CLuaFunctionDefs.Browser.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,16 @@ int CLuaFunctionDefs::ExecuteBrowserJavascript ( lua_State* luaVM )
342342

343343
if ( !argStream.HasErrors () )
344344
{
345-
lua_pushboolean ( luaVM, pWebBrowser->ExecuteJavascript ( strJavascriptCode ) );
346-
return 1;
345+
if ( pWebBrowser->ExecuteJavascript ( strJavascriptCode ) )
346+
{
347+
lua_pushboolean ( luaVM, true );
348+
return 1;
349+
}
350+
else
351+
argStream.SetCustomError ( "This function does not work with local browsers" );
347352
}
348-
else
353+
354+
if ( argStream.HasErrors () )
349355
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
350356

351357
lua_pushboolean ( luaVM, false );

0 commit comments

Comments
 (0)