[Libreoffice-commits] core.git: include/comphelper

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 11 22:32:09 UTC 2019


 include/comphelper/windowsdebugoutput.hxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 9be7991df15da9d4d954eeac1ec342ad1a2b7467
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Apr 11 23:23:46 2019 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Apr 12 01:26:02 2019 +0300

    Don't crash if the BSTR pointer in a VARIANT is (weirdly) null
    
    Change-Id: I8473b1f411a45c7c17e742ca0d69245d77f078f7

diff --git a/include/comphelper/windowsdebugoutput.hxx b/include/comphelper/windowsdebugoutput.hxx
index 26c95fea5c22..7033b811a66c 100644
--- a/include/comphelper/windowsdebugoutput.hxx
+++ b/include/comphelper/windowsdebugoutput.hxx
@@ -420,8 +420,11 @@ inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, t
             stream << static_cast<double>(rVariant.date);
             break; // FIXME
         case VT_BSTR:
-            stream << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(
-                rVariant.bstrVal);
+            if (rVariant.bstrVal == nullptr)
+                stream << "(null)";
+            else
+                stream << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(
+                    rVariant.bstrVal));
             break;
         case VT_DISPATCH:
             stream << rVariant.pdispVal;


More information about the Libreoffice-commits mailing list