Axivion: check variant types for issue path links

Only create a link if both the values for 'path' and 'line' match the
expected types (string for 'path' and double for 'line' respectively).
If the types don't match we assume this to be a bug or corrupt data so
it justifies skipping the creation of the link entirely.

Change-Id: Iac923a5d268a80bc4b62f4744ad7b1d99a159db6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Andreas Loth <andreas.loth@qt.io>
This commit is contained in:
Mehdi Salem
2024-08-21 10:39:44 +02:00
committed by Mohammad Mehdi Salem Naraghi
parent d79c9506bf
commit abb2236d4b

View File

@@ -516,10 +516,12 @@ static QList<LinkWithColumns> linksForIssue(const std::map<QString, Dto::Any> &i
QList<int> columns; QList<int> columns;
auto it = issueRow.find(path); auto it = issueRow.find(path);
if (it != end && !it->second.isNull()) { if (it != end && !it->second.isNull()) {
QTC_ASSERT(it->second.isString(), return);
Link link{ FilePath::fromUserInput(it->second.getString()) }; Link link{ FilePath::fromUserInput(it->second.getString()) };
columns.append(findColumn(it->first)); columns.append(findColumn(it->first));
it = issueRow.find(line); it = issueRow.find(line);
if (it != end) { if (it != end && !it->second.isNull()) {
QTC_ASSERT(it->second.isDouble(), return);
link.targetLine = it->second.getDouble(); link.targetLine = it->second.getDouble();
columns.append(findColumn(it->first)); columns.append(findColumn(it->first));
} }