Skip to content

Commit

Permalink
Fixed bug where MUSHclient would crash on startup if prefs database l…
Browse files Browse the repository at this point in the history
…ocked
  • Loading branch information
nickgammon committed Sep 16, 2010
1 parent ec10d6c commit 8363e59
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
13 changes: 10 additions & 3 deletions MUSHclient.cpp
Expand Up @@ -1857,6 +1857,10 @@ CTextDocument * CMUSHclientApp::FindNotepad (const CString strTitle)
{
CTextDocument * pTextDoc = NULL;

// during startup, may not exist
if (App.m_pNormalDocTemplate == NULL)
return NULL;

for (POSITION docPos = App.m_pNormalDocTemplate->GetFirstDocPosition();
docPos != NULL; )
{
Expand Down Expand Up @@ -2095,11 +2099,14 @@ void CMUSHclientApp::db_show_error (const char * sql)
return;

CString strTitle = "SQL errors in global preferences";
CString strMessage = CFormat ("SQL error on statement:\r\n\"%s\"\r\n%s\r\n", sql, sqlite3_errmsg(db));

AppendToTheNotepad (strTitle,
CFormat ("SQL error on statement:\r\n\"%s\"\r\n%s\r\n", sql, sqlite3_errmsg(db)),
if (!AppendToTheNotepad (strTitle,
strMessage,
false, // append
eNotepadWorldLoadError);
eNotepadWorldLoadError))
// emergency fallback
::AfxMessageBox ( (LPCTSTR) strMessage, MB_ICONEXCLAMATION );

// make sure they see it
ActivateNotepad (strTitle);
Expand Down
9 changes: 1 addition & 8 deletions MUSHclient.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Utilities.cpp
Expand Up @@ -255,6 +255,9 @@ bool CreateTextWindow (const char * sText,
const int iLines,
const int iNotepadType)
{
// during startup, may not exist
if (App.m_pNormalDocTemplate == NULL)
return false;

CTextDocument * pNewDoc = (CTextDocument *)
App.m_pNormalDocTemplate->OpenDocumentFile(NULL);
Expand Down

0 comments on commit 8363e59

Please sign in to comment.