diff -r 58e4ce7dd217 -r e71642121fb6 src/EditRecipe.cpp --- a/src/EditRecipe.cpp Fri Apr 22 13:46:59 2022 +0200 +++ b/src/EditRecipe.cpp Sat Apr 23 08:47:50 2022 +0200 @@ -96,7 +96,12 @@ query.prepare("SELECT * FROM recipes WHERE record = :recno"); query.bindValue(":recno", id); query.exec(); - query.first(); + if (! query.first()) { + qDebug() << "EditRecipe seek error record" << id; + QMessageBox::warning(this, tr("Database error"), tr("MySQL error: record %1 not found").arg(id)); + this->done(QDialog::Rejected); // At this stage, this doesn't work because the dialog is not yet visible. + return; + } QSqlRecord rec = query.record(); for (int i = 0; i < rec.count(); i++)