mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 10:20:17 -06:00
Don't allow query execution when no database is opened
Some time ago we changed the Execute SQL tab to allow open SQL files even if no database is loaded in order to provide an SQL editor without needing a database. If no database file is opened the Execute buttons were greyed out but the F5/Ctrl+R shortcut would still work, causing an "out of memory" error. That error doesn't cause any harm but is a bit confusing. So this commit disables the keyboard shortcuts too.
This commit is contained in:
@@ -897,6 +897,11 @@ void MainWindow::dataTableSelectionChanged(const QModelIndex& index)
|
||||
*/
|
||||
void MainWindow::executeQuery()
|
||||
{
|
||||
// Make sure a database is opened. This is necessary because we allow opened SQL editor tabs even if no database is loaded. Hitting F5 or similar
|
||||
// then might call this function.
|
||||
if(!db.isOpen())
|
||||
return;
|
||||
|
||||
SqlExecutionArea* sqlWidget = qobject_cast<SqlExecutionArea*>(ui->tabSqlAreas->currentWidget());
|
||||
|
||||
// Get SQL code to execute. This depends on the button that's been pressed
|
||||
|
||||
Reference in New Issue
Block a user