summaryrefslogtreecommitdiffhomepage
path: root/whiteboard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'whiteboard.cpp')
-rw-r--r--whiteboard.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/whiteboard.cpp b/whiteboard.cpp
index fcfdca8..8736726 100644
--- a/whiteboard.cpp
+++ b/whiteboard.cpp
@@ -167,12 +167,14 @@ std::string Whiteboard::handle_request(Whiteboard::connection& c, const std::str
pt::ptree ptree;
ptree.put_child("diff", xml.get_child("request.diff"));
Diff d{ptree};
- std::string data {m_storage->getDocument(id)};
- data = d.apply(data);
+ if (!d.empty()) {
+ std::string data {m_storage->getDocument(id)};
+ data = d.apply(data);
- m_storage->setDocument(id, data);
- m_registry.setId(c, id);
- notify_other_connections_diff(c, id, d);
+ m_storage->setDocument(id, data);
+ m_registry.setId(c, id);
+ notify_other_connections_diff(c, id, d);
+ }
int pos {xml.get<int>("request.pos")};
if (m_storage->getCursorPos(id) != pos) {