]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listctrl.cpp
Fix wxString unit test when not using UTF-8.
[wxWidgets.git] / src / msw / listctrl.cpp
index 8d0bead33322e74eb0fdfe37d8e76e9bdef60782..3c3e797059c39eaabeffe36b91f82f187725035c 100644 (file)
@@ -1656,6 +1656,12 @@ long wxListCtrl::InsertItem(const wxListItem& info)
 {
     wxASSERT_MSG( !IsVirtual(), wxT("can't be used with virtual controls") );
 
+    // In 2.8 it was possible to succeed inserting an item without initializing
+    // its ID as it defaulted to 0. This was however never supported and in 2.9
+    // the ID is -1 by default and inserting it simply fails, but it might be
+    // not obvious why does it happen, so check it proactively.
+    wxASSERT_MSG( info.m_itemId != -1, wxS("Item ID must be set.") );
+
     LV_ITEM item;
     wxConvertToMSWListItem(this, info, item);
     item.mask &= ~LVIF_PARAM;