From 67b0492431db9ea08ddd563541f4992bb1bff07d Mon Sep 17 00:00:00 2001 From: Daniel Bainton Date: Wed, 13 Aug 2008 09:22:18 +0000 Subject: [PATCH] Adding some checks to check if win is defined --- content/buffer.js | 2 +- content/ui.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/content/buffer.js b/content/buffer.js index 4d3dc88f..8b20f1dd 100644 --- a/content/buffer.js +++ b/content/buffer.js @@ -105,7 +105,7 @@ liberator.Buffer = function () //{{{ function findScrollableWindow() { var win = window.document.commandDispatcher.focusedWindow; - if (win.scrollMaxX > 0 || win.scrollMaxY > 0) + if (win && (win.scrollMaxX > 0 || win.scrollMaxY > 0)) return win; win = window.content; diff --git a/content/ui.js b/content/ui.js index aadaa566..9e560f66 100644 --- a/content/ui.js +++ b/content/ui.js @@ -1454,6 +1454,8 @@ liberator.StatusLine = function () //{{{ if (!percent || typeof percent != "number") { var win = document.commandDispatcher.focusedWindow; + if (!win) + return; percent = win.scrollMaxY == 0 ? -1 : win.scrollY / win.scrollMaxY; }