[partition] More conservative handling of device pointers

- thanks @abucodonosor
main
Adriaan de Groot 8 years ago
parent a6edb3ed34
commit 6316173f1b

@ -165,9 +165,13 @@ PartitionPage::updateButtons()
if ( m_ui->deviceComboBox->currentIndex() >= 0 ) if ( m_ui->deviceComboBox->currentIndex() >= 0 )
{ {
Device* device = nullptr;
QModelIndex deviceIndex = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 ); QModelIndex deviceIndex = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 );
auto device = m_core->deviceModel()->deviceForIndex( deviceIndex ); if ( deviceIndex.isValid() )
if ( device->type() != Device::Type::LVM_Device ) device = m_core->deviceModel()->deviceForIndex( deviceIndex );
if ( !device )
cWarning() << "Device for updateButtons is nullptr";
else if ( device->type() != Device::Type::LVM_Device )
{ {
createTable = true; createTable = true;

Loading…
Cancel
Save