Dialog_DatabasePreferences: Move a null check to earlier.

Found by Coverity Scan.