Skip to content

Commit

Permalink
Check if EventEmitter is not null
Browse files Browse the repository at this point in the history
  * Fix for Automattic#7342.

Signed-off-by: Milo Casagrande <[email protected]>
  • Loading branch information
MiloCasagrande committed Dec 17, 2018
1 parent 2a0521f commit a37c111
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 a37c111

Please sign in to comment.