From 57ce4e252a0ccd98a9e89ac15f1b0a36ae26ec3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Thu, 31 Jul 2014 14:10:18 +0100 Subject: [PATCH] Fix an exception when pressing up-arrow in a buffer without history --- js/glowingbear.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index 3f442a3..22f5d75 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -1577,7 +1577,9 @@ weechat.directive('inputBar', function() { // Set cursor to last position. Need 0ms timeout because browser sets cursor // position to the beginning after this key handler returns. setTimeout(function() { - inputNode.setSelectionRange($scope.command.length, $scope.command.length); + if ($scope.command) { + inputNode.setSelectionRange($scope.command.length, $scope.command.length); + } }, 0); return true; }