From 5601fd2eff111df01ad4526215ce45fb3b3b6a6e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 25 Jan 2013 15:18:32 +0000 Subject: fix for the automatic database creation git-svn-id: http://svn.miranda-ng.org/main/trunk@3281 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/database/database.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/modules/database/database.cpp') diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index ae7bf05764..b55a46ac3e 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -389,16 +389,16 @@ int makeDatabase(TCHAR *profile, DATABASELINK * link, HWND hwndDlg) } // enumerate all plugins that had valid DatabasePluginInfo() -int tryOpenDatabase(const TCHAR* tszProfile) +int tryOpenDatabase(const TCHAR *tszProfile) { for (int i=arDbPlugins.getCount()-1; i >= 0; i--) { - DATABASELINK* p = arDbPlugins[i]; + DATABASELINK *p = arDbPlugins[i]; // liked the profile? int err = p->grokHeader(tszProfile); if (err == ERROR_SUCCESS) { // added APIs? - MIDatabase* pDb = p->Load(tszProfile); + MIDatabase *pDb = p->Load(tszProfile); if (pDb) { fillProfileName(tszProfile); currDblink = p; @@ -434,8 +434,11 @@ static int tryCreateDatabase(const TCHAR* ptszProfile) int err = p->makeDatabase(tszProfile); if (err == ERROR_SUCCESS) { - if ( !p->Load(tszProfile)) { + MIDatabase *pDb = p->Load(tszProfile); + if (pDb != NULL) { fillProfileName(tszProfile); + currDblink = p; + db_setCurrent(currDb = pDb); return 0; } return 1; @@ -522,7 +525,8 @@ int LoadDatabaseModule(void) retry = MessageBox(0, buf, TranslateT("Miranda can't open that profile"), MB_RETRYCANCEL | MB_ICONERROR) == IDRETRY; } } - } while (retry); + } + while (retry); if (rc == ERROR_SUCCESS) { InitIni(); -- cgit v1.2.3