Proceed only if the database is found

This fixes the bug reported at https://github.com/phpmyadmin/phpmyadmin/commit/b43f4c7fed71963e499ef7bf81cf24b3cc73cf9b#commitcomment-4014159