]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/choice.cpp
Whole lot of stuff for new wxFileDialog
[wxWidgets.git] / src / msw / choice.cpp
index 92cab89387a009ef064bd78136d9f2e6511a263c..3f104ea206f77736dd65906130a2c019b8f1d13e 100644 (file)
@@ -154,15 +154,15 @@ int wxChoice::FindString(const wxString& s) const
 wxString wxChoice::GetString(int n) const
 {
     size_t len = (size_t)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0);
-    wxString str;
-    if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n,
-                       (LPARAM)str.GetWriteBuf(len)) == CB_ERR )
-    {
-        wxLogLastError("SendMessage(CB_GETLBTEXT)");
+    wxString str = "";
+    if (len) {
+        if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n,
+                           (LPARAM)str.GetWriteBuf(len)) == CB_ERR ) {
+            wxLogLastError("SendMessage(CB_GETLBTEXT)");
+        }
+        str.UngetWriteBuf();
     }
 
-    str.UngetWriteBuf();
-
     return str;
 }
 
@@ -186,7 +186,7 @@ void* wxChoice::DoGetClientData( int n ) const
         wxLogLastError(_T("CB_GETITEMDATA"));
 
         // unfortunately, there is no way to return an error code to the user
-        rc = NULL;
+       rc = (LPARAM) NULL;
     }
 
     return (void *)rc;