History

Prevent crash on entity-script-server for due to logging interface.

Kalila L committed 6 years ago

Commit 50067e31 parent 22aa9f21 file · +5 −0Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+5−0
@@ -130,6 +130,11 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) { · 129 unmodified lines
130 // This message was sent by one of our script engines, let's try to see if we can find the source.130 // This message was sent by one of our script engines, let's try to see if we can find the source.
131 // Note that the first entry in the backtrace should be "print" and is somewhat useless to us131 // Note that the first entry in the backtrace should be "print" and is somewhat useless to us
132 AbstractLoggerInterface* loggerInterface = AbstractLoggerInterface::get();132 AbstractLoggerInterface* loggerInterface = AbstractLoggerInterface::get();
133 if (!loggerInterface) {
134 qCDebug(scriptengine_script, "%s", qUtf8Printable(message));
135 return QScriptValue();
136 }
137
133 if (loggerInterface->showSourceDebugging()) {138 if (loggerInterface->showSourceDebugging()) {
134 QScriptContext* userContext = context;139 QScriptContext* userContext = context;
135 while (userContext && QScriptContextInfo(userContext).functionType() == QScriptContextInfo::NativeFunction) {140 while (userContext && QScriptContextInfo(userContext).functionType() == QScriptContextInfo::NativeFunction) {