summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2019-04-11 23:23:46 +0300
committerTor Lillqvist <tml@collabora.com>2019-04-12 01:26:02 +0300
commit9be7991df15da9d4d954eeac1ec342ad1a2b7467 (patch)
treecc2d825d094686bda35a6ce9449fbede27af3e6a /include
parentad7302b5a62bbf382fb7e900cedfa317a4bf57d8 (diff)
Don't crash if the BSTR pointer in a VARIANT is (weirdly) null
Change-Id: I8473b1f411a45c7c17e742ca0d69245d77f078f7
Diffstat (limited to 'include')
-rw-r--r--include/comphelper/windowsdebugoutput.hxx7
1 files changed, 5 insertions, 2 deletions
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;