    for (auto &[s, dbc_file] : dbc()->dbc_files) {
      if (!dbc_file->filename.isEmpty()) {
        dbc_file->save();
        updateRecentFiles(dbc_file->filename);
      } else {
        QString fn = QFileDialog::getSaveFileName(this, tr("Save File"), QDir::cleanPath(settings.last_dir + "/untitled.dbc"), tr("DBC (*.dbc)"));
        if (!fn.isEmpty()) {
          dbc_file->saveAs(fn);
          updateRecentFiles(fn);
        }
 
</s> remove   assert(dbc()->dbcCount() > 0);
  auto &[_, dbc_file] = dbc()->dbc_files.first();

  QString fn = QFileDialog::getSaveFileName(this, tr("Save File"), QDir::cleanPath(settings.last_dir + "/untitled.dbc"), tr("DBC (*.dbc)"));
  if (!fn.isEmpty()) {
    dbc_file->saveAs(fn);
 </s> add   for (auto &[s, dbc_file] : dbc()->dbc_files) {
    if (dbc_file->isEmpty()) continue;
    QString fn = QFileDialog::getSaveFileName(this, tr("Save File"), QDir::cleanPath(settings.last_dir + "/untitled.dbc"), tr("DBC (*.dbc)"));
    if (!fn.isEmpty()) {
      dbc_file->saveAs(fn);
    } </s> remove   assert(dbc()->dbcCount() > 0);

  auto &[_, dbc_file] = dbc()->dbc_files.first();
  QGuiApplication::clipboard()->setText(dbc_file->generateDBC());
  QMessageBox::information(this, tr("Copy To Clipboard"), tr("DBC Successfully copied!"));
 </s> add   for (auto &[s, dbc_file] : dbc()->dbc_files) {
    if (dbc_file->isEmpty()) continue;
    QGuiApplication::clipboard()->setText(dbc_file->generateDBC());
    QMessageBox::information(this, tr("Copy To Clipboard"), tr("DBC Successfully copied!"));
  } </s> remove   if (dbc()->dbcCount() > 1) {
 </s> add   int cnt = dbc()->nonEmptyDBCCount();
  save_dbc->setEnabled(cnt > 0);

  if (cnt > 1) {
    } else if (!dbc_file->isEmpty()) {
    for (auto &[s, dbc_file] : dbc()->dbc_files) {
      if (!dbc_file->filename.isEmpty()) {
        dbc_file->save();
        updateRecentFiles(dbc_file->filename);
    } else if (!dbc_file->isEmpty()) {
        QString fn = QFileDialog::getSaveFileName(this, tr("Save File"), QDir::cleanPath(settings.last_dir + "/untitled.dbc"), tr("DBC (*.dbc)"));
        if (!fn.isEmpty()) {
          dbc_file->saveAs(fn);
          updateRecentFiles(fn);
        }
keep keep keep keep replace keep keep keep keep keep
 cabana: do not try to save empty wildcard DBC (#27898)

* cabana: do not try to save empty wildcard DBC

* use reference 
tools/cabana/mainwin.cc