[gnome-documents] lokview: Hack to not crash when zooming PDFs right after start-up



commit 1380ad9c8dcdebf9d4970dd04757ef696d82ca32
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jan 21 16:10:38 2016 +0100

    lokview: Hack to not crash when zooming PDFs right after start-up
    
    LOKDocView's zoom methods crash when no document is loaded. It needs to
    be careful because it shares the same GActions with EvView.
    
    LibreOffice bug for the same:
    https://bugs.documentfoundation.org/show_bug.cgi?id=97301
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760940

 src/lokview.js |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/lokview.js b/src/lokview.js
index f04dfa1..190ddcc 100644
--- a/src/lokview.js
+++ b/src/lokview.js
@@ -139,6 +139,9 @@ const LOKView = new Lang.Class({
         this._zoomIn = Application.application.lookup_action('zoom-in');
         let zoomInId = this._zoomIn.connect('activate', Lang.bind(this,
             function() {
+                // FIXME: https://bugs.documentfoundation.org/show_bug.cgi?id=97301
+                if (!this._doc)
+                    return;
                 let zoomLevel = this.view.get_zoom() * ZOOM_IN_FACTOR;
                 this.view.set_zoom(zoomLevel);
             }));
@@ -146,6 +149,9 @@ const LOKView = new Lang.Class({
         this._zoomOut = Application.application.lookup_action('zoom-out');
         let zoomOutId = this._zoomOut.connect('activate', Lang.bind(this,
             function() {
+                // FIXME: https://bugs.documentfoundation.org/show_bug.cgi?id=97301
+                if (!this._doc)
+                    return;
                 let zoomLevel = this.view.get_zoom() * ZOOM_OUT_FACTOR;
                 this.view.set_zoom(zoomLevel);
             }));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]