diff --git a/utils.cpp b/utils.cpp index f725a0e1d4..588634f2d2 100644 --- a/utils.cpp +++ b/utils.cpp @@ -129,14 +129,17 @@ QByteArray getStringProperty(xcb_window_t w, xcb_atom_t prop, char separator) return QByteArray(); } char *data = static_cast(xcb_get_property_value(property.data())); + int length = property->value_len; if (data && separator) { for (uint32_t i = 0; i < property->value_len; ++i) { if (!data[i] && i + 1 < property->value_len) { data[i] = separator; + } else { + length = i; } } } - return QByteArray(data, property->value_len); + return QByteArray(data, length); } #ifndef KCMRULES