This avoids an error when scrolling the preview window but the window is not visible (e.g. due to a screen resize).