]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/valtext.cpp
Don't crash on malformed HTML in wxHTML font tag handler.
[wxWidgets.git] / src / common / valtext.cpp
index ebd0c3cefc2f0481b6efff1bd82a5c1cf009d888..43c87eb446842040c0011db68a5d8f401c06d9e2 100644 (file)
@@ -33,6 +33,8 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include "wx/combo.h"
+
 // ----------------------------------------------------------------------------
 // global helpers
 // ----------------------------------------------------------------------------
@@ -125,8 +127,16 @@ wxTextEntry *wxTextValidator::GetTextEntry()
     }
 #endif
 
+#if wxUSE_COMBOCTRL
+    if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboCtrl)))
+    {
+        return (wxComboCtrl*)m_validatorWindow;
+    }
+#endif
+
     wxFAIL_MSG(
-        wxT("wxTextValidator can only be used with wxTextCtrl or wxComboBox")
+        "wxTextValidator can only be used with wxTextCtrl, wxComboBox, "
+        "or wxComboCtrl"
     );
 
     return NULL;
@@ -232,7 +242,7 @@ wxString wxTextValidator::IsValid(const wxString& val) const
         return _("'%s' should only contain alphabetic characters.");
     if ( HasFlag(wxFILTER_ALPHANUMERIC) && !CheckString(wxIsalnum, val) )
         return _("'%s' should only contain alphabetic or numeric characters.");
-    if ( HasFlag(wxFILTER_DIGITS) && CheckString(wxIsdigit, val) )
+    if ( HasFlag(wxFILTER_DIGITS) && !CheckString(wxIsdigit, val) )
         return _("'%s' should only contain digits.");
     if ( HasFlag(wxFILTER_NUMERIC) && !wxIsNumeric(val) )
         return _("'%s' should be numeric.");