[Libreoffice-commits] online.git: common/Log.hpp common/Session.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Jan 1 03:55:09 UTC 2017


 common/Log.hpp     |    1 +
 common/Session.cpp |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9e677e268f7e4456da5d568e6a5a75fabb887ca7
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Dec 21 18:15:27 2016 -0500

    wsd: new LOG_CHECK_RET to log failure and return
    
    This is to replace assertion for non-fatal cases.
    
    Change-Id: I6f8aedea52fb861309d0bc8f8f9cd43395da0805
    Reviewed-on: https://gerrit.libreoffice.org/32550
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/common/Log.hpp b/common/Log.hpp
index ee7dc55..f4ba714 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -181,6 +181,7 @@ namespace Log
 #define LOG_SFL(X) if (Log::errorEnabled()) { LOG_BODY("FTL", X << " (errno: " << std::strerror(errno) << ")"); Log::logger().fatal(oss_.str()); }
 
 #define LOG_CHECK(X) if (!(X)) { LOG_ERR("Check failed. Expected (" #X ")."); }
+#define LOG_CHECK_RET(X, RET) if (!(X)) { LOG_ERR("Check failed. Expected (" #X ")."); return RET; }
 
 #endif
 
diff --git a/common/Session.cpp b/common/Session.cpp
index 0e51de5..afebb3b 100644
--- a/common/Session.cpp
+++ b/common/Session.cpp
@@ -217,7 +217,7 @@ void Session::shutdown(Poco::UInt16 statusCode, const std::string& statusMessage
 
 bool Session::handleInput(const char *buffer, int length)
 {
-    assert(buffer != nullptr);
+    LOG_CHECK_RET(buffer != nullptr, false);
 
     try
     {


More information about the Libreoffice-commits mailing list