Browse Source

[fb] Opening an empty file should not create a js error

Karissa McKelvey 11 years ago
parent
commit
f078e13
1 changed files with 5 additions and 2 deletions
  1. 5 2
      apps/filebrowser/src/filebrowser/templates/display.mako

+ 5 - 2
apps/filebrowser/src/filebrowser/templates/display.mako

@@ -108,8 +108,11 @@ ${ fb_components.menubar() }
   var pages = {};
 
   function resizeText () {
-    $("#fileArea").height($(window).height() - $("#fileArea").offset().top - 26);
-    $("#loader").css("marginLeft", ($("#fileArea").width() - $("#loader").width()) / 2);
+    var _fileArea = $("#fileArea");
+    if (_fileArea.height() > 0) {
+      _fileArea.height($(window).height() - _fileArea.offset().top - 26);
+      $("#loader").css("marginLeft", (_fileArea.width() - $("#loader").width()) / 2);
+    }
   }
 
   function formatHex (number, padding) {