From 0a94d1e475406f966cb643857429928390764643 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 23 Mar 2016 13:44:29 +0000 Subject: [PATCH] avoid null callback --- services/spelling/app/coffee/ASpellWorker.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/spelling/app/coffee/ASpellWorker.coffee b/services/spelling/app/coffee/ASpellWorker.coffee index 05e4a93adb..be0fa1f257 100644 --- a/services/spelling/app/coffee/ASpellWorker.coffee +++ b/services/spelling/app/coffee/ASpellWorker.coffee @@ -41,8 +41,11 @@ class ASpellWorker output = output + chunk # We receive the language code from Aspell as the end of data marker if chunk.toString().match(endMarker) - @callback(null, output.slice()) - @callback = null # only allow one callback in use + if @callback? + @callback(null, output.slice()) + @callback = null # only allow one callback in use + else + logger.err process: @pipe.pid, lang: @language, "end of data marker received when callback already used" @state = 'ready' output = "" error = ""