]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/combobox_osx.cpp
Fix crash in wxMSW wxProgressDialog without wxPD_APP_MODAL style.
[wxWidgets.git] / src / osx / combobox_osx.cpp
index 214bdbdff4611cb5d23a4247635fc17ca8a1fd0a..8ab1cf9c1e0bc0fe641a1af1ef701e858e8cadb5 100644 (file)
@@ -186,12 +186,15 @@ int wxComboBox::FindString(const wxString& s, bool bCase) const
 
 wxString wxComboBox::GetString(unsigned int n) const
 {
+    wxCHECK_MSG( n < GetCount(), wxString(), "Invalid combobox index" );
+
     return GetComboPeer()->GetStringAtIndex(n);
 }
 
 wxString wxComboBox::GetStringSelection() const
 {
-    return GetString(GetSelection());
+    const int sel = GetSelection();
+    return sel == wxNOT_FOUND ? wxString() : GetString(sel);
 }
 
 void wxComboBox::SetString(unsigned int n, const wxString& s)