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();
|
||||
}
|
||||
|
||||
bool Diagnostic::isValid() const
|
||||
{
|
||||
return !description.isEmpty();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClangStaticAnalyzer
|
||||
|
@@ -56,6 +56,8 @@ public:
|
||||
class Diagnostic
|
||||
{
|
||||
public:
|
||||
bool isValid() const;
|
||||
|
||||
QString description;
|
||||
QString category;
|
||||
QString type;
|
||||
|
@@ -168,6 +168,7 @@ DetailedErrorDelegate::SummaryLineInfo ClangStaticAnalyzerDiagnosticDelegate::su
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
const Diagnostic diagnostic = index.data(Qt::UserRole).value<Diagnostic>();
|
||||
QTC_ASSERT(diagnostic.isValid(), return SummaryLineInfo());
|
||||
|
||||
DetailedErrorDelegate::SummaryLineInfo info;
|
||||
info.errorText = diagnostic.description;
|
||||
@@ -188,6 +189,8 @@ QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
|
||||
const Diagnostic diagnostic = index.data(Qt::UserRole).value<Diagnostic>();
|
||||
if (!diagnostic.isValid())
|
||||
return widget;
|
||||
|
||||
// Add summary label
|
||||
QLabel *summaryLineLabel = createSummaryLabel(diagnostic);
|
||||
|
Reference in New Issue
Block a user