From: Kevin Lamonte Date: Wed, 27 Dec 2017 23:41:34 +0000 (-0500) Subject: #25 fix NPE on double-click in secondary thread X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=5255f69c14d2c19f0e2f1f4ae8d9a106c92d3b8c;p=fanfix-jexer.git #25 fix NPE on double-click in secondary thread --- diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index ee2e9de..34f1559 100644 --- a/src/jexer/TApplication.java +++ b/src/jexer/TApplication.java @@ -1125,8 +1125,14 @@ public class TApplication implements Runnable { } secondaryEventReceiver.handleEvent(event); - if (doubleClick != null) { - secondaryEventReceiver.handleEvent(doubleClick); + // Note that it is possible for secondaryEventReceiver to be null + // now, because its handleEvent() might have finished out on the + // secondary thread. So put any extra processing inside a null + // check. + if (secondaryEventReceiver != null) { + if (doubleClick != null) { + secondaryEventReceiver.handleEvent(doubleClick); + } } }