avoid null callback

This commit is contained in:
Brian Gough 2016-03-23 13:44:29 +00:00
parent 8239bcd0b5
commit 0a94d1e475

View file

@ -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 = ""