Fix Crash on accessing invalid Flags

This commit is contained in:
Justin Hammond 2020-06-12 15:24:49 +08:00
parent 167180c9ac
commit 5aa5f01fea
2 changed files with 2 additions and 1 deletions

View file

@ -24,6 +24,7 @@ void Node_Delegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
QSize Node_Delegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
Q_UNUSED(option);
NodeFlagsWidget fw;
fw.setValue(index.data().value<QBitArray>());
return fw.sizeHint();

View file

@ -56,7 +56,7 @@ NodeFlagsWidget::~NodeFlagsWidget()
void NodeFlagsWidget::setValue(QBitArray value) {
this->m_value = value;
for (int i = 0; i <= value.size(); i++) {
for (int i = 0; i < this->m_value.size(); i++) {
switch (i) {
case QTOZW_Nodes::nodeFlags::isAwake:
{