Merge pull request #1781 from evhan55/extensions/rpc-error

Adding check for open request before calling RPC reject/resolve.
This commit is contained in:
Evelyn Eastmond 2018-11-27 12:06:10 -08:00 committed by GitHub
commit acc2e6dba2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,10 +86,12 @@ class JSONRPC {
const {result, error, id} = json; const {result, error, id} = json;
const openRequest = this._openRequests[id]; const openRequest = this._openRequests[id];
delete this._openRequests[id]; delete this._openRequests[id];
if (error) { if (openRequest) {
openRequest.reject(error); if (error) {
} else { openRequest.reject(error);
openRequest.resolve(result); } else {
openRequest.resolve(result);
}
} }
} }