summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2019-07-11 13:15:09 +0200
committerBenoit Foucher <benoit@zeroc.com>2019-07-11 13:15:09 +0200
commit7f7401b4e626b7e917dea9dc84c992ddfa305ef6 (patch)
tree8d6ae2d3b7199cff193b7def6eeedbc6257d1a36 /python
parentFixed another Java IceSSL failure on RHEL8, fixes #431 (diff)
downloadice-7f7401b4e626b7e917dea9dc84c992ddfa305ef6.tar.bz2
ice-7f7401b4e626b7e917dea9dc84c992ddfa305ef6.tar.xz
ice-7f7401b4e626b7e917dea9dc84c992ddfa305ef6.zip
Fixed Ruby crash (and similar issues in other mappings), fixes #432
Diffstat (limited to 'python')
-rw-r--r--python/modules/IcePy/Types.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/python/modules/IcePy/Types.cpp b/python/modules/IcePy/Types.cpp
index 7ecc7379af7..00b821099b6 100644
--- a/python/modules/IcePy/Types.cpp
+++ b/python/modules/IcePy/Types.cpp
@@ -520,10 +520,10 @@ IcePy::StreamUtil::setSlicedDataMember(PyObject* obj, const Ice::SlicedDataPtr&
if((*p)->bytes.size() > 0)
{
#if PY_VERSION_HEX >= 0x03000000
- bytes = PyBytes_FromStringAndSize(reinterpret_cast<const char*>(&(*p)->bytes[0]),
+ bytes = PyBytes_FromStringAndSize((*p)->bytes.empty() ? 0 : reinterpret_cast<const char*>(&(*p)->bytes[0]),
static_cast<Py_ssize_t>((*p)->bytes.size()));
#else
- bytes = PyString_FromStringAndSize(reinterpret_cast<const char*>(&(*p)->bytes[0]),
+ bytes = PyString_FromStringAndSize((*p)->bytes.empty() ? 0 : reinterpret_cast<const char*>(&(*p)->bytes[0]),
static_cast<Py_ssize_t>((*p)->bytes.size()));
#endif
}