- if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n,
- (LPARAM)str.GetWriteBuf(len)) == CB_ERR )
- {
- wxLogLastError("SendMessage(CB_GETLBTEXT)");
+ if (len) {
+ if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n,
+ (LPARAM)str.GetWriteBuf(len)) == CB_ERR ) {
+ wxLogLastError("SendMessage(CB_GETLBTEXT)");
+ }
+ str.UngetWriteBuf();