diff --git a/Common/Gfx/TextFormatD2D.cpp b/Common/Gfx/TextFormatD2D.cpp index 224b084b..df9ee0b6 100644 --- a/Common/Gfx/TextFormatD2D.cpp +++ b/Common/Gfx/TextFormatD2D.cpp @@ -201,7 +201,7 @@ DWRITE_TEXT_METRICS TextFormatD2D::GetMetrics( { // GDI+ compatibility: If the last character is a newline, GDI+ measurements seem to ignore it. bool strippedLastNewLine = false; - if (str[strLen - 1] == L'\n') + if (strLen > 2 && str[strLen - 1] == L'\n') { strippedLastNewLine = true; --strLen;