Skip to content

Commit

Permalink
Fixed crash if attempts to Note were done before output buffer ready
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed May 8, 2011
1 parent 5072cd1 commit 9ac3d51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions doc.cpp
Expand Up @@ -1797,6 +1797,10 @@ CLine * pOriginalLine = m_pCurrentLine;
CString strOriginalText;
CString strLine (lpszText, size);

// cannot go very far without this - must be called at world loadup from a plugin OnPluginInstall
if (m_pLinePositions == NULL)
return;

// decompressed data has a size, not a null terminator.
// Also, compressed data may have imbedded nulls.

Expand Down
4 changes: 2 additions & 2 deletions scripting/methods/methods_noting.cpp
Expand Up @@ -46,7 +46,7 @@ void CMUSHclientDoc::Tell(LPCTSTR Message)
return;

// if output buffer doesn't exist yet, remember note for later
if (m_pCurrentLine == NULL)
if (m_pCurrentLine == NULL || m_pLinePositions == NULL)
{
COLORREF fore = m_iNoteColourFore,
back = m_iNoteColourBack;
Expand Down Expand Up @@ -520,7 +520,7 @@ void CMUSHclientDoc::Hyperlink(LPCTSTR Action,
BOOL URL)
{
// return if attempt to do tell (or note) before output buffer exists
if (m_pCurrentLine == NULL)
if (m_pCurrentLine == NULL || m_pLinePositions == NULL)
return;

// don't muck around if empty message
Expand Down

0 comments on commit 9ac3d51

Please sign in to comment.