diff --git a/src/core/service/api/ui/create-selector-query.js b/src/core/service/api/ui/create-selector-query.js index 37c6fe4ffd8..8fd0e5aa9d4 100644 --- a/src/core/service/api/ui/create-selector-query.js +++ b/src/core/service/api/ui/create-selector-query.js @@ -98,17 +98,19 @@ class SelectorQuery { exec (callback) { invokeMethod('requestComponentInfo', this._page, this._queue, res => { const queueCbs = this._queueCb - res.forEach((result, index) => { - if (Array.isArray(result)) { - result.forEach(convertContext) - } else { - convertContext(result) - } - const queueCb = queueCbs[index] - if (isFn(queueCb)) { - queueCb.call(this, result) - } - }) + if(res && res.length) { + res.forEach((result, index) => { + if (Array.isArray(result)) { + result.forEach(convertContext) + } else { + convertContext(result) + } + const queueCb = queueCbs[index] + if (isFn(queueCb)) { + queueCb.call(this, result) + } + }) + } isFn(callback) && callback.call(this, res) })