1
0
mirror of https://github.com/ONLYOFFICE/core.git synced 2025-04-18 14:04:06 +03:00

Fix command with empty states

This commit is contained in:
Svetlana Kulikova 2025-03-12 16:23:09 +03:00
parent 6e9500a6e7
commit 89d965283b

View File

@ -2175,7 +2175,7 @@ namespace PdfReader
}
void RendererOutputDev::clip(GfxState* pGState)
{
if (m_bDrawOnlyText)
if (m_bDrawOnlyText || m_sStates.empty())
return;
if (!m_sStates.back().pClip)
@ -2186,7 +2186,7 @@ namespace PdfReader
}
void RendererOutputDev::eoClip(GfxState* pGState)
{
if (m_bDrawOnlyText)
if (m_bDrawOnlyText || m_sStates.empty())
return;
if (!m_sStates.back().pClip)
@ -2197,7 +2197,7 @@ namespace PdfReader
}
void RendererOutputDev::clipToStrokePath(GfxState* pGState)
{
if (m_bDrawOnlyText)
if (m_bDrawOnlyText || m_sStates.empty())
return;
if (!m_sStates.back().pClip)
@ -2251,7 +2251,7 @@ namespace PdfReader
}
void RendererOutputDev::endTextObject(GfxState* pGState)
{
if (m_sStates.back().pTextClip && 4 <= pGState->getRender())
if (!m_sStates.empty() && m_sStates.back().pTextClip && 4 <= pGState->getRender())
{
AddTextClip(pGState, &m_sStates.back());
updateFont(pGState);
@ -2591,9 +2591,13 @@ namespace PdfReader
m_pRenderer->get_FontSize(&dTempFontSize);
m_pRenderer->get_FontStyle(&lTempFontStyle);
// tmpchange
if (!m_sStates.back().pTextClip)
m_sStates.back().pTextClip = new GfxTextClip();
m_sStates.back().pTextClip->ClipToText(wsTempFontName, wsTempFontPath, dTempFontSize, (int)lTempFontStyle, arrMatrix, wsClipText, dShiftX, /*-fabs(pFont->getFontBBox()[3]) * dTfs + */ dShiftY, 0, 0, 0);
if (!m_sStates.empty())
{
if (!m_sStates.back().pTextClip)
m_sStates.back().pTextClip = new GfxTextClip();
m_sStates.back().pTextClip->ClipToText(wsTempFontName, wsTempFontPath, dTempFontSize, (int)lTempFontStyle, arrMatrix, wsClipText, dShiftX, /*-fabs(pFont->getFontBBox()[3]) * dTfs + */ dShiftY, 0, 0, 0);
}
}
m_pRenderer->put_FontSize(dOldSize);