deps/obs-scripting: Allow NULL script with script_log

(This commit also modifies the frontend-tools module)

Prevents a potential crash when script_log is called by a thread spawned
by a python library.
This commit is contained in:
jp9000
2018-01-31 01:46:16 -08:00
parent c87597f7d6
commit a2ae16e98c
3 changed files with 24 additions and 10 deletions

View File

@@ -494,9 +494,14 @@ static void script_log(void *, obs_script_t *script, int log_level,
const char *message)
{
QString qmsg;
qmsg = QStringLiteral("[%1] %2").arg(
obs_script_get_file(script),
message);
if (script) {
qmsg = QStringLiteral("[%1] %2").arg(
obs_script_get_file(script),
message);
} else {
qmsg = QStringLiteral("[Unknown Script] %1").arg(message);
}
QMetaObject::invokeMethod(scriptLogWindow, "AddLogMsg",
Q_ARG(int, log_level),