Skip to content

Commit

Permalink
Merge pull request #1090 from ra3xdh/fix_crash_on_missing_symbol
Browse files Browse the repository at this point in the history
Fixed crash in SpiceLibComp dialog
  • Loading branch information
ra3xdh authored Nov 24, 2024
2 parents 5e36d2f + 9bcb20b commit 5d47d79
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions qucs/extsimkernels/spicelibcompdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,22 @@ SpiceLibCompDialog::SpiceLibCompDialog(Component *pc, Schematic *sch) : QDialog{
QStringList lst_patterns;
misc::getSymbolPatternsList(lst_patterns);
listSymPattern->addItems(lst_patterns);
if (lst_patterns.isEmpty()) {
QString dir_name = QucsSettings.BinDir + "/../share/" QUCS_NAME "/symbols/";
QString msg = tr("No symbol files found at the following path:\n");
msg += dir_name;
msg += tr("\nCheck you installation!\n");
QMessageBox::warning(this,tr("Warning"),msg);
}
listSymPattern->setCurrentRow(0);
listSymPattern->setSelectionMode(QAbstractItemView::SingleSelection);
connect(listSymPattern,SIGNAL(currentRowChanged(int)),this,SLOT(slotSetSymbol()));

rbAutoSymbol = new QRadioButton(tr("Automatic symbol"));
rbSymFromTemplate = new QRadioButton(tr("Symbol from template"));
if (lst_patterns.isEmpty()) {
rbSymFromTemplate->setEnabled(false);
}
rbUserSym = new QRadioButton(tr("Symbol from file"));
btnOpenSym = new QPushButton(tr("Open"));
edtSymFile = new QLineEdit();
Expand Down Expand Up @@ -349,6 +359,9 @@ void SpiceLibCompDialog::slotSetSymbol()
symbol->setWarning(tr("No symbol loaded"));
symbolPinsCount = 0;
} else if (rbSymFromTemplate->isChecked()) {
if (listSymPattern->currentItem() == nullptr) {
return; // empty list
}
tbwPinsTable->setEnabled(true);
listSymPattern->setEnabled(true);
edtSymFile->setEnabled(false);
Expand Down

0 comments on commit 5d47d79

Please sign in to comment.