From b5ef2ac4894c691ca3179b48deaf189682e943ab Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 22 Apr 2015 14:14:14 +0200 Subject: [PATCH] Avoid using negative width in generic wxTimePickerCtrl. If there is not enough space for the text, make it of size 0, not negative. Closes #16960. --- src/generic/timectrlg.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/generic/timectrlg.cpp b/src/generic/timectrlg.cpp index f4b6b8fd00..50f27bc4d9 100644 --- a/src/generic/timectrlg.cpp +++ b/src/generic/timectrlg.cpp @@ -26,6 +26,7 @@ #ifndef WX_PRECOMP #include "wx/textctrl.h" + #include "wx/utils.h" // wxMax() #endif // WX_PRECOMP #include "wx/timectrl.h" @@ -661,7 +662,7 @@ void wxTimePickerCtrlGeneric::DoMoveWindow(int x, int y, int width, int height) return; const int widthBtn = m_impl->m_btn->GetSize().x; - const int widthText = width - widthBtn - HMARGIN_TEXT_SPIN; + const int widthText = wxMax(width - widthBtn - HMARGIN_TEXT_SPIN, 0); m_impl->m_text->SetSize(0, 0, widthText, height); m_impl->m_btn->SetSize(widthText + HMARGIN_TEXT_SPIN, 0, widthBtn, height);