forked from qt-creator/qt-creator
Check for valid Diagnostic
Change-Id: Icfce44a373d56f008027330f9b1a2d446f4d2adb Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -46,5 +46,10 @@ bool ExplainingStep::isValid() const
|
|||||||
return location.isValid() && !ranges.isEmpty() && !message.isEmpty();
|
return location.isValid() && !ranges.isEmpty() && !message.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Diagnostic::isValid() const
|
||||||
|
{
|
||||||
|
return !description.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace ClangStaticAnalyzer
|
} // namespace ClangStaticAnalyzer
|
||||||
|
@@ -56,6 +56,8 @@ public:
|
|||||||
class Diagnostic
|
class Diagnostic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
bool isValid() const;
|
||||||
|
|
||||||
QString description;
|
QString description;
|
||||||
QString category;
|
QString category;
|
||||||
QString type;
|
QString type;
|
||||||
|
@@ -168,6 +168,7 @@ DetailedErrorDelegate::SummaryLineInfo ClangStaticAnalyzerDiagnosticDelegate::su
|
|||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
const Diagnostic diagnostic = index.data(Qt::UserRole).value<Diagnostic>();
|
const Diagnostic diagnostic = index.data(Qt::UserRole).value<Diagnostic>();
|
||||||
|
QTC_ASSERT(diagnostic.isValid(), return SummaryLineInfo());
|
||||||
|
|
||||||
DetailedErrorDelegate::SummaryLineInfo info;
|
DetailedErrorDelegate::SummaryLineInfo info;
|
||||||
info.errorText = diagnostic.description;
|
info.errorText = diagnostic.description;
|
||||||
@@ -188,6 +189,8 @@ QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont
|
|||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
|
|
||||||
const Diagnostic diagnostic = index.data(Qt::UserRole).value<Diagnostic>();
|
const Diagnostic diagnostic = index.data(Qt::UserRole).value<Diagnostic>();
|
||||||
|
if (!diagnostic.isValid())
|
||||||
|
return widget;
|
||||||
|
|
||||||
// Add summary label
|
// Add summary label
|
||||||
QLabel *summaryLineLabel = createSummaryLabel(diagnostic);
|
QLabel *summaryLineLabel = createSummaryLabel(diagnostic);
|
||||||
|
Reference in New Issue
Block a user