diff --git a/source/gui/ObjectTypes/CButton.cpp b/source/gui/ObjectTypes/CButton.cpp index 85a9af2143..1f0ac79b93 100644 --- a/source/gui/ObjectTypes/CButton.cpp +++ b/source/gui/ObjectTypes/CButton.cpp @@ -26,6 +26,7 @@ #include "maths/Rect.h" #include "maths/Size2D.h" +#include #include CButton::CButton(CGUI& pGUI) @@ -76,7 +77,7 @@ CSize2D CButton::GetTextSize() CSize2D CButton::GetPreferredTextSize() { - return CGUIText{m_pGUI, m_Caption, m_Font, m_pGUI.GetWindowSize().Width, m_BufferZone, m_TextAlign, this}.GetSize(); + return CGUIText{m_pGUI, m_Caption, m_Font, std::numeric_limits::max(), m_BufferZone, m_TextAlign, this}.GetSize(); } void CButton::HandleMessage(SGUIMessage& Message)