Skip to content

Commit

Permalink
fixed SonarQube bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vividos committed Nov 12, 2020
1 parent aacf207 commit 85c89da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ulib/stream/TextStreamFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ void TextStreamFilter::Write(const CString& text)
case textEncodingAnsi:
{
CStringA ansiText = text;
LPCSTR textPtr = ansiText;
m_stream.Write(textPtr, static_cast<DWORD>(strlen(textPtr) * sizeof(*textPtr)), numWriteBytes);
LPCSTR textPtr = ansiText.GetString();
if (ansiText.GetLength() > 0 && textPtr != nullptr)
m_stream.Write(textPtr, static_cast<DWORD>(strlen(textPtr) * sizeof(*textPtr)), numWriteBytes);
}
break;

Expand Down

0 comments on commit 85c89da

Please sign in to comment.