[Libreoffice-commits] online.git: loolwsd/ChildSession.cpp loolwsd/ChildSession.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sat May 21 03:22:52 UTC 2016


 loolwsd/ChildSession.cpp |    6 +++++-
 loolwsd/ChildSession.hpp |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit c6454ff9ed0c48465d05dc5314fb3371698b9298
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri May 20 17:26:19 2016 -0400

    loolwsd: protect against null lok::Document
    
    Change-Id: Iffa9c7f708d04bede5d98ba311e499a0874605fc
    Reviewed-on: https://gerrit.libreoffice.org/25237
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/ChildSession.cpp b/loolwsd/ChildSession.cpp
index be23b7f..e9e9960 100644
--- a/loolwsd/ChildSession.cpp
+++ b/loolwsd/ChildSession.cpp
@@ -117,7 +117,11 @@ public:
         case LOK_CALLBACK_INVALIDATE_TILES:
             {
                 const auto lokitDoc = _session.getLoKitDocument();
-                assert(lokitDoc);
+                if (lokitDoc == nullptr)
+                {
+                    return;
+                }
+
                 assert(lokitDoc->pClass);
                 assert(lokitDoc->pClass->getPart);
 
diff --git a/loolwsd/ChildSession.hpp b/loolwsd/ChildSession.hpp
index 61557f6..a0e42d9 100644
--- a/loolwsd/ChildSession.hpp
+++ b/loolwsd/ChildSession.hpp
@@ -48,7 +48,7 @@ public:
 
     const std::string& getDocType() const { return _docType; }
 
-    LibreOfficeKitDocument *getLoKitDocument() const { return _loKitDocument->get(); }
+    LibreOfficeKitDocument *getLoKitDocument() const { return (_loKitDocument ? _loKitDocument->get() : nullptr); }
 
     void loKitCallback(const int nType, const char* pPayload);
 


More information about the Libreoffice-commits mailing list