]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/choice.cpp
Added missing files to filelist.txt and regenerated makefiles.
[wxWidgets.git] / src / msw / choice.cpp
index a40148b58b983fa723444767f75db05c1b1a26fe..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;
 }