--- a/editor/include/adminer.inc.php
+++ b/editor/include/adminer.inc.php
@@ -19,11 +19,13 @@
 	
 	function database() {
 		global $connection;
-		$databases = $this->databases(false);
-		return (!$databases
-			? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
-			: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database
-		);
+		if ($connection) {
+			$databases = $this->databases(false);
+			return (!$databases
+				? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list
+				: $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database
+			);
+		}
 	}
 	
 	function databases($flush = true) {