Skip to content

Commit

Permalink
Merge pull request Automattic#7346 from MiloCasagrande/master
Browse files Browse the repository at this point in the history
Check if EventEmitter is not null
  • Loading branch information
vkarpov15 authored Dec 18, 2018
2 parents 0daef39 + a37c111 commit 7911895
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ exports.promiseOrCallback = function promiseOrCallback(callback, fn, ee) {
return new Promise((resolve, reject) => {
fn(function(error, res) {
if (error != null) {
if (ee.listeners('error').length > 0 && !error[emittedSymbol]) {
if (ee != null && ee.listeners('error').length > 0 && !error[emittedSymbol]) {
error[emittedSymbol] = true;
ee.emit('error', error);
}
Expand Down

0 comments on commit 7911895

Please sign in to comment.