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

Miklos Vajna vmiklos at collabora.co.uk
Mon Sep 19 14:04:45 UTC 2016


 loolwsd/LOOLKit.cpp |   28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

New commits:
commit ea274bcf6b94400cd4e3f13f1ac954ed5c24a36c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Sep 19 16:04:23 2016 +0200

    Document::ViewCallback: don't fail on EMPTY cell cursor
    
    Change-Id: I67bee2a1f1332bfb82963e0fb3a0e761054f826e

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 29d84f4..d5d3fc9 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -814,12 +814,16 @@ private:
             nType == LOK_CALLBACK_CELL_CURSOR)
         {
             Poco::StringTokenizer tokens(payload, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
-            auto cursorX = std::stoi(tokens[0]);
-            auto cursorY = std::stoi(tokens[1]);
-            auto cursorWidth = std::stoi(tokens[2]);
-            auto cursorHeight = std::stoi(tokens[3]);
+            // Payload may be 'EMPTY'.
+            if (tokens.count() == 4)
+            {
+                auto cursorX = std::stoi(tokens[0]);
+                auto cursorY = std::stoi(tokens[1]);
+                auto cursorWidth = std::stoi(tokens[2]);
+                auto cursorHeight = std::stoi(tokens[3]);
 
-            pDescr->Doc->_tileQueue->updateCursorPosition(0, 0, cursorX, cursorY, cursorWidth, cursorHeight);
+                pDescr->Doc->_tileQueue->updateCursorPosition(0, 0, cursorX, cursorY, cursorWidth, cursorHeight);
+            }
         }
         else if (nType == LOK_CALLBACK_INVALIDATE_VIEW_CURSOR ||
                  nType == LOK_CALLBACK_CELL_VIEW_CURSOR)
@@ -831,12 +835,16 @@ private:
             auto part = command->get("part").toString();
             auto text = command->get("rectangle").toString();
             Poco::StringTokenizer tokens(text, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
-            auto cursorX = std::stoi(tokens[0]);
-            auto cursorY = std::stoi(tokens[1]);
-            auto cursorWidth = std::stoi(tokens[2]);
-            auto cursorHeight = std::stoi(tokens[3]);
+            // Payload may be 'EMPTY'.
+            if (tokens.count() == 4)
+            {
+                auto cursorX = std::stoi(tokens[0]);
+                auto cursorY = std::stoi(tokens[1]);
+                auto cursorWidth = std::stoi(tokens[2]);
+                auto cursorHeight = std::stoi(tokens[3]);
 
-            pDescr->Doc->_tileQueue->updateCursorPosition(std::stoi(viewId), std::stoi(part), cursorX, cursorY, cursorWidth, cursorHeight);
+                pDescr->Doc->_tileQueue->updateCursorPosition(std::stoi(viewId), std::stoi(part), cursorX, cursorY, cursorWidth, cursorHeight);
+            }
         }
 
         // Forward to the same view only.


More information about the Libreoffice-commits mailing list