mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Fix the invalid pointer dereference bug in the combo widget
This commit is contained in:
committed by
Baldur Karlsson
parent
789a2a131c
commit
3624d6e30b
@@ -697,8 +697,11 @@ void MiniQtHelper::SetComboOptions(QWidget *combo, const rdcarray<rdcstr> &optio
|
||||
for(const rdcstr &o : options)
|
||||
texts << o;
|
||||
|
||||
comb->clear();
|
||||
comb->addItems(texts);
|
||||
if(comb)
|
||||
{
|
||||
comb->clear();
|
||||
comb->addItems(texts);
|
||||
}
|
||||
}
|
||||
|
||||
size_t MiniQtHelper::GetComboCount(QWidget *combo)
|
||||
@@ -707,7 +710,10 @@ size_t MiniQtHelper::GetComboCount(QWidget *combo)
|
||||
return 0;
|
||||
const QComboBox *comb = qobject_cast<const QComboBox *>(combo);
|
||||
|
||||
return comb->count();
|
||||
if(comb)
|
||||
return comb->count();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MiniQtHelper::SelectComboOption(QWidget *combo, const rdcstr &option)
|
||||
@@ -716,5 +722,6 @@ void MiniQtHelper::SelectComboOption(QWidget *combo, const rdcstr &option)
|
||||
return;
|
||||
QComboBox *comb = qobject_cast<QComboBox *>(combo);
|
||||
|
||||
comb->setCurrentText(option);
|
||||
if(comb)
|
||||
comb->setCurrentText(option);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user