Kopete - jabber: Prevent startup crashes

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit d6dc04becb)
pull/38/head
Michele Calgaro 8 years ago committed by Slávek Banko
parent a1ff2d6315
commit f43fe7ee82

@ -84,17 +84,10 @@ static TQDomElement stripExtraNS(const TQDomElement &e)
// to make it pretty. // to make it pretty.
static TQString xmlToString(const TQDomElement &e, const TQString &fakeNS, const TQString &fakeTQName, bool clip) static TQString xmlToString(const TQDomElement &e, const TQString &fakeNS, const TQString &fakeTQName, bool clip)
{ {
TQDomElement i = e.cloneNode().toElement();
// It seems TQDom can only have one namespace attribute at a time (see docElement 'HACK').
// Fortunately we only need one kind depending on the input, so it is specified here.
TQDomElement fake = e.ownerDocument().createElementNS(fakeNS, fakeTQName);
fake.appendChild(i);
fake = stripExtraNS(fake);
TQString out; TQString out;
{ {
TQTextStream ts(&out, IO_WriteOnly); TQTextStream ts(&out, IO_WriteOnly);
fake.firstChild().save(ts, 0); e.save(ts, 0);
} }
// 'clip' means to remove any unwanted (and unneeded) characters, such as a trailing newline // 'clip' means to remove any unwanted (and unneeded) characters, such as a trailing newline
if(clip) { if(clip) {

Loading…
Cancel
Save