{"record":{"id":"2ea7774f2cb2970b","repo":"Tencent/QMUI_Android","slug":"message-null","errorCode":null,"errorMessage":"message == null","messagePattern":"message == null","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"qmui/src/main/assets/QMUIWebviewBridge.js","lineNumber":23,"sourceCode":"    }\n    var messagingIframe = createIframe(doc);\n    var sendingMessageQueue = [];\n    var receivedMessageQueue = [];\n    var messageHandlers = {};\n    var QUEUE_HAS_MESSAGE = 'qmui://__QUEUE_MESSAGE__/';\n    var responseCallbacks = {};\n    var uuid = 1;\n\n    function createIframe(doc) {\n        var iframe = doc.createElement('iframe');\n        iframe.style.display = 'none';\n        doc.documentElement.appendChild(iframe);\n        return iframe;\n    }\n\n    function send(data, callback) {\n        if(!data){\n            throw new Error(\"message == null\")\n        }\n        var message = {\n            data: data\n        }\n        if(callback){\n            var callbackId = 'cb_' + (uuid++) + '_' + (new Date() - 0);\n            responseCallbacks[callbackId] = callback;\n            message.callbackId = callbackId;\n        }\n        sendingMessageQueue.push(message);\n        messagingIframe.src = QUEUE_HAS_MESSAGE;\n    }\n\n    function isCmdSupport(cmd, callback){\n        if(isCmdSupport.__cache && isCmdSupport.__cache.indexOf(cmd) >= 0){\n            callback(true)\n            return\n        }","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/Tencent/QMUI_Android/blob/026e7d486677d6593a96689cd590ec3561176717/qmui/src/main/assets/QMUIWebviewBridge.js#L5-L41","documentation":"In QMUIWebviewBridge.js, the send(data, callback) function is the bridge's message dispatcher. It throws Error(\"message == null\") when data is falsy (null, undefined, or empty), because an empty message cannot be serialized or dispatched to the native side.","triggerScenarios":"Calling send(null/undefined/'') directly, or indirectly via getSupportedCmdList if the command payload construction yields an empty/falsy data value.","commonSituations":"JS page calls bridge.send() before building the message object; variable holding the message is undefined due to a typo or failed fetch; empty response passed through to the bridge.","solutions":["Ensure a non-empty data object is built before calling send.","Check for undefined/empty values at the call site and bail out early.","Inspect getSupportedCmdList and other internal send() callers to verify they always construct a payload."],"exampleFix":"// before\nbridge.send(msg) // msg may be undefined\n// after\nif (msg) { bridge.send(msg) } else { console.warn('skip empty bridge message') }","handlingStrategy":"validation","validationCode":"function safeSend(bridge, data, cb) { if (!data) { console.warn('empty bridge message'); return } bridge.send(data, cb) }","typeGuard":"function isBridgeMessage(d) { return d !== null && d !== undefined && d !== '' }","tryCatchPattern":"try { bridge.send(data, cb) } catch (e) { console.error('bridge send failed', e) }","preventionTips":["Build the message payload before calling send","Assert payload non-empty in a wrapper","Trace data sources that may resolve to undefined"],"tags":["javascript","webview","bridge","null-argument"],"backgroundTag":"null-argument","analyzedSha":"026e7d486677d6593a96689cd590ec3561176717","analyzedAt":"2026-09-06T13:32:24.816Z","contentChangedAt":"2026-09-06T13:32:24.816Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}