fix potential context npe
This commit is contained in:
parent
0a7b66aeb3
commit
c79362188a
@ -11,8 +11,17 @@ DoricBridgeExtension::DoricBridgeExtension(QObject *parent) : QObject(parent) {}
|
|||||||
void DoricBridgeExtension::callNative(QString contextId, QString module,
|
void DoricBridgeExtension::callNative(QString contextId, QString module,
|
||||||
QString methodName, QString callbackId,
|
QString methodName, QString callbackId,
|
||||||
QString argument) {
|
QString argument) {
|
||||||
|
qDebug() << "contextId: " + contextId << "module: " + module
|
||||||
|
<< "methodName: " + methodName << "callbackId: " + callbackId
|
||||||
|
<< "jsValue: " + argument;
|
||||||
|
|
||||||
DoricContext *context =
|
DoricContext *context =
|
||||||
DoricContextManager::getInstance()->getContext(contextId);
|
DoricContextManager::getInstance()->getContext(contextId);
|
||||||
|
|
||||||
|
if (context == nullptr) {
|
||||||
|
qCritical() << "cannot find context: " + contextId;
|
||||||
|
return;
|
||||||
|
}
|
||||||
bool classRegistered =
|
bool classRegistered =
|
||||||
context->getDriver()->getRegistry()->acquirePluginInfo(module);
|
context->getDriver()->getRegistry()->acquirePluginInfo(module);
|
||||||
if (classRegistered) {
|
if (classRegistered) {
|
||||||
@ -22,7 +31,4 @@ void DoricBridgeExtension::callNative(QString contextId, QString module,
|
|||||||
Q_ARG(QString, argument),
|
Q_ARG(QString, argument),
|
||||||
Q_ARG(QString, callbackId));
|
Q_ARG(QString, callbackId));
|
||||||
}
|
}
|
||||||
qDebug() << "contextId: " + contextId << "module: " + module
|
|
||||||
<< "methodName: " + methodName << "callbackId: " + callbackId
|
|
||||||
<< "jsValue: " + argument;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user