templatescollection.cpp: fix QDomDocument::ParseResult->bool conversion

Since Qt 6.5, QDomDocument::setContent() returns a ParseResult
struct with an *explicit* operator bool(), so 'bool x =
doc.setContent(...)' (copy-initialization) no longer compiles -
explicit conversions aren't considered there.

This exact issue was already fixed in titleblocktemplate.cpp by
dropping the intermediate bool and testing the call directly in
the if condition (contextual bool conversion in an if() is fine
even for an explicit operator bool), but this second occurrence
in templatescollection.cpp used the same pattern and was missed.
Applying the same fix here for consistency.
This commit is contained in:
scorpio810
2026-07-17 07:52:03 +00:00
committed by Laurent Trinques
parent 6716c267b8
commit 287b532953
+1 -2
View File
@@ -454,8 +454,7 @@ QDomElement TitleBlockTemplatesFilesCollection::getTemplateXmlDescription(const
} }
QDomDocument *xml_document = new QDomDocument(); QDomDocument *xml_document = new QDomDocument();
bool xml_parsing = xml_document -> setContent(&xml_file); if (!xml_document -> setContent(&xml_file)) {
if (!xml_parsing) {
delete xml_document; delete xml_document;
return(QDomElement()); return(QDomElement());
} }