From 3b8ec46fd26d644e6edbea4f46e630929297e448 Mon Sep 17 00:00:00 2001 From: samhed Date: Thu, 5 Mar 2015 09:54:56 +0100 Subject: [PATCH] Make the touch-keyboard code more robust through verifying that global variables are set before use. --- include/ui.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/ui.js b/include/ui.js index a5433dc..fb28e3e 100644 --- a/include/ui.js +++ b/include/ui.js @@ -925,8 +925,15 @@ var UI; // This code is required since some browsers on Android are inconsistent in // sending keyCodes in the normal keyboard events when using on screen keyboards. keyInput: function(event) { + + if (!UI.rfb) { return; } + var newValue = event.target.value; - var oldValue = UI.lastKeyboardinput; + + if (!UI.lastKeyboardinput) { + UI.keyboardinputReset(); + } + var oldvalue = UI.lastKeyboardinput; var newLen; try {