mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 05:20:45 +00:00
Don't crash in data() if no data has ever been set. Allow adding columns
This commit is contained in:
@@ -260,7 +260,7 @@ RDTreeWidgetItem::~RDTreeWidgetItem()
|
||||
|
||||
QVariant RDTreeWidgetItem::data(int column, int role) const
|
||||
{
|
||||
if(column >= m_data->count())
|
||||
if(m_data == NULL || column >= m_data->count())
|
||||
return QVariant();
|
||||
|
||||
const QVector<RoleData> &dataVec = (*m_data)[column];
|
||||
|
||||
@@ -50,7 +50,10 @@ public:
|
||||
inline void setIcon(int column, const QIcon &icon)
|
||||
{
|
||||
if(column >= m_icons.size())
|
||||
return;
|
||||
{
|
||||
m_text.resize(column + 1);
|
||||
m_icons.resize(m_text.size());
|
||||
}
|
||||
|
||||
m_icons[column] = icon;
|
||||
dataChanged(column, Qt::DecorationRole);
|
||||
@@ -94,7 +97,10 @@ public:
|
||||
inline void setText(int column, const QVariant &value)
|
||||
{
|
||||
if(column >= m_text.size())
|
||||
return;
|
||||
{
|
||||
m_text.resize(column + 1);
|
||||
m_icons.resize(m_text.size());
|
||||
}
|
||||
|
||||
m_text[column] = value;
|
||||
dataChanged(column, Qt::DisplayRole);
|
||||
|
||||
Reference in New Issue
Block a user